Example #1
0
 function __construct()
 {
     include "config.php";
     $config = new config();
     define("LOGIN_PATH", dirname(__FILE__) . "/" . $config->get("auth", "login-path"));
     session_start();
     if (isset($_POST["email"]) and isset($_POST["password"])) {
         // load user information
         $users = $config->get("auth", "users");
         // find current user
         foreach ($users as $user) {
             if ($user["email"] == $_POST["email"]) {
                 break;
             }
         }
         // verify password and set session cookie
         if (password_verify($_POST["password"], $user["hash"])) {
             $_SESSION["user"] = array("email" => $user["email"], "name" => $user["name"]);
         } else {
             $this->login();
         }
     } elseif (!isset($_SESSION["user"])) {
         $this->login();
     }
 }
Example #2
0
function AbreBancoJP()
{
    $con = new config();
    $id = AbreBanco($con->get_host(), $con->get_login(), $con->get_pass(), $con->get_banco());
    mysql_set_charset('utf8', $id);
    return $id;
}
Example #3
0
 function get_table_group($table, $primaryKey, $columns, $where, $group)
 {
     $config = new config();
     $sql_details = $config->sql_details();
     require 'ssp.class.php';
     echo json_encode(SSP::simplewheregroup($_POST, $sql_details, $table, $primaryKey, $columns, $where, $group));
 }
Example #4
0
 function roundedBox()
 {
     $objconfig = new config();
     $this->getDomainPath = $objconfig->get_domain_path();
     $this->color = "";
     $this->heading = "";
 }
 function getNice()
 {
     if ($this->config['source']['type'] == 'table' && isset($this->config['source']['name'])) {
         global $thinkedit;
         $config = new config();
         //$table = $thinkedit->newTable($this->config['source']['name']);
         //
         //$source->filter('id', '=', $this->getRaw());
         $source_table = $this->config['source']['name'];
         $title_fields = $config->getTitleFields($source_table);
         require_once 'query.class.php';
         $query = new query();
         $query->addTable($this->config['source']['name']);
         $query->addWhere('id', '=', $this->getRaw());
         $results = $query->select();
         if (count($results) > 0) {
             foreach ($config->getTitleFields($source_table) as $field) {
                 $out .= $results[0][$field] . ' ';
             }
             return $out;
         } else {
             return $this->getRaw();
         }
     } else {
         return $this->getRaw();
     }
 }
Example #6
0
 public function __construct(&$theArray)
 {
     ENTER("minimenu::minimenu", __LINE__);
     $a = new config("gilles", $anElement);
     unset($anOption);
     foreach ($anElement as $a) {
         switch ($a->getType()) {
             case MINIMENU_CATEGORY:
                 $anOption[] = "+ " . $a->name;
                 break;
             case MINIMENU_PROGRAM:
                 $anOption[] = "* " . $a->name;
                 break;
             case MINIMENU_DOCUMENT:
                 $anOption[] = $a->name;
                 break;
         }
     }
     $this->_myTerminal = new enhancedTerminal();
     if (!$this->_myTerminal->isBuild()) {
         $this->_myTerminal = new dumbTerminal($theTerminal);
     }
     $this->myDialog = new cliDialog($this->_myTerminal, false);
     $aTitle = "";
     $theText = NULL;
     $theSelectedOption = NULL;
     $theKeyIsDisplayed = false;
     $this->myDialog->menu($aTitle, $anOption, &$aResult, NULL, NULL, false);
 }
function Objeto($valor)
{
    require_once "clase/config.class.php";
    setlocale(LC_MONETARY, 'en_US');
    $esta_configuracion = new config();
    $configuracion = $esta_configuracion->variable();
    include_once $configuracion["raiz_documento"] . $configuracion["clases"] . "/funcionGeneral.class.php";
    include_once $configuracion["raiz_documento"] . $configuracion["clases"] . "/html.class.php";
    $conexion = new funcionGeneral();
    $conexionOracle = $conexion->conectarDB($configuracion, "oracle3");
    $html = new html();
    $busqueda = "SELECT ";
    $busqueda .= "obj_cod, ";
    $busqueda .= "obj_nombre ";
    $busqueda .= "FROM ";
    $busqueda .= "objetos ";
    $busqueda .= "WHERE ";
    $busqueda .= "obj_tio_cod =" . $valor;
    $resultado = $conexion->ejecutarSQL($configuracion, $conexionOracle, $busqueda, "busqueda");
    if (is_array($resultado)) {
        $mi_cuadro = $html->cuadro_lista($resultado, 'objeto', $configuracion, -1, 2, FALSE, $tab++, "objeto", 100);
    } else {
        $mi_cuadro = "No hay registros relacionados";
    }
    $respuesta = new xajaxResponse();
    $respuesta->addAssign("divObjeto", "innerHTML", $mi_cuadro);
    return $respuesta;
}
Example #8
0
 function get_table_join($table, $table2, $primaryKey, $columns, $on, $where, $group, $dataArray)
 {
     $config = new config();
     $sql_details = $config->sql_details();
     require 'ssp.class.php';
     echo json_encode(SSP::complexjoin($_POST, $sql_details, $table, $table2, $primaryKey, $columns, $on, $where, $group, $dataArray));
 }
Example #9
0
 function checktoken()
 {
     if ($this->shopid) {
         $config = new config("autorun_{$this->shopid}.php", hopedir);
     } else {
         $config = new config('autorun.php', hopedir);
     }
     $tempinfo = $config->getInfo();
     if (isset($tempinfo['access_token']) && isset($tempinfo['wx_time'])) {
         $btime = time() - $tempinfo['wx_time'];
         if ($btime < 7000) {
             $this->access_token = $tempinfo['access_token'];
             return true;
         }
     }
     //通过post方法获取  当前token;
     $info = $this->vpost('https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $this->wxappid . '&secret=' . $this->wxsecret);
     $info = json_decode($info, true);
     if (isset($info['access_token'])) {
         $test['access_token'] = $info['access_token'];
         $this->access_token = $info['access_token'];
         $test['wx_time'] = time();
         $config->write($test);
         return true;
     } else {
         $this->errId = $info['errcode'];
         return false;
     }
 }
Example #10
0
function dato($Campo)
{
    global $folder;
    include_once $folder . "class/config.php";
    $config = new config();
    $cnf = $config->mostrarConfig($Campo);
    return htmlspecialchars($cnf['Valor']);
}
Example #11
0
function getPassword($fEmail, $sqlconn)
{
    $table = 'UserInfo';
    $queryType = 'Select';
    $condition = array('Email', $fEmail, 'text');
    $types = array('text');
    $columns = array('Password');
    $values = array(null);
    $args = array('column' => $columns, 'value' => $values, 'type' => $types);
    $xml = createXML($table, $args);
    $res = $sqlconn->query($xml, $queryType, $condition);
    $thepassword = getValue($res);
    if ($thepassword == '') {
        echo 'Account does not exist';
    } else {
        $mail = new PHPMailer(true);
        //New instance, with exceptions enabled
        $body = "Password: "******"\r\nReturn to site: http://www.you-mix.com";
        $body = preg_replace('/\\\\/', '', $body);
        //Strip backslashes
        $mail->IsSMTP();
        // telling the class to use SMTP
        //$mail->Host       = "mail.you-mix.com"; // SMTP server
        $mail->Host = "smtp.sendgrid.net";
        //$mail->Host       = "smtp.mail.me.com"; // SMTP server
        $mail->SMTPDebug = 1;
        // enables SMTP debug information (for testing)
        // 1 = errors and messages
        // 2 = messages only                           // tell the class to use SMTP
        $mail->SMTPAuth = true;
        // enable SMTP authentication
        $mail->Port = 25;
        // set the SMTP server port
        //$mail->Port       = 587;                    // set the SMTP server port
        $mail->Username = "******";
        // SMTP server username
        //$mail->Username   = "******";     // SMTP server username
        $config = new config();
        $mail->Password = $config->getSMTPPass();
        // SMTP server password
        $mail->AddReplyTo("*****@*****.**", "YouMix");
        $mail->From = "*****@*****.**";
        $mail->FromName = "YouMix";
        //$to = "*****@*****.**";
        $mail->AddAddress($fEmail);
        $mail->Subject = "you-mix.com: Password retrieval";
        $mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
        // optional, comment out and test
        $mail->WordWrap = 80;
        // set word wrap
        $mail->MsgHTML($body);
        $mail->IsHTML(true);
        // send as HTML
        $mail->Send();
        echo 'Password has been sent.';
    }
}
Example #12
0
 public static function establishConnection($cmd)
 {
     $config = new config();
     $dsn = $config->getDSN();
     if ($cmd = 'open') {
         return MDB2::connect($dsn);
     } else {
         if ($cmd = 'close') {
             return null;
         }
     }
 }
Example #13
0
	/**
	 * Show the file to the client
	 *
	 * @param string $prm File requested
	 */
	public static function get($prm) {
		self::init();
		$prm = self::$cfg->dir.
			str_replace(
				array(self::$cfg->webDir.'/', '/'),
				array('', DS)
				, $prm);
		if (self::$cfg->getInArray('forceDownload', file::getExt($prm)))
			response::getInstance()->sendFile($prm);
		else
			response::getInstance()->showFile($prm);
	}
Example #14
0
 function photo($files)
 {
     $objConfig = new config();
     $objCommon = new common();
     $this->domainPath = $objConfig->get_domain_path();
     $this->fullPath = $objConfig->get_full_domain_path();
     $this->uploadDir = $objConfig->get_upload_dir();
     $this->imageQuality = $objCommon->getConfigValue("imageQuality");
     $this->files = $files;
     $this->description = "";
     $this->fileType = "";
     $this->title = "";
     $this->tags = "";
 }
Example #15
0
 public function tearDown()
 {
     parent::tearDown();
     /* required for PHP < 5.3 */
     config::$chroot_dir = "";
     config::$compile_temp_directory = "/tmp";
 }
Example #16
0
/**
* Initialize Spam-X plugin configuration
*
* Creates the database entries for the configuation if they don't already
* exist. Initial values will be taken from $_SPX_CONF if available (e.g. from
* an old config.php), uses $_SPX_DEFAULT otherwise.
*
* @return   boolean     true: success; false: an error occurred
*
*/
function plugin_initconfig_spamx()
{
    global $_CONF, $_SPX_CONF, $_SPX_DEFAULT;
    if (is_array($_SPX_CONF) && count($_SPX_CONF) > 1) {
        $_SPX_DEFAULT = array_merge($_SPX_DEFAULT, $_SPX_CONF);
    }
    $c = config::get_instance();
    if (!$c->group_exists('spamx')) {
        $enable_email = true;
        if (empty($_SPX_DEFAULT['notification_email']) || $_SPX_DEFAULT['notification_email'] == $_CONF['site_mail']) {
            $enable_email = false;
        }
        $c->add('sg_main', NULL, 'subgroup', 0, 0, NULL, 0, true, 'spamx');
        $c->add('fs_main', NULL, 'fieldset', 0, 0, NULL, 0, true, 'spamx');
        $c->add('logging', $_SPX_DEFAULT['logging'], 'select', 0, 0, 1, 10, true, 'spamx');
        $c->add('admin_override', $_SPX_DEFAULT['admin_override'], 'select', 0, 0, 1, 20, true, 'spamx');
        $c->add('timeout', $_SPX_DEFAULT['timeout'], 'text', 0, 0, null, 30, true, 'spamx');
        $c->add('notification_email', $_SPX_DEFAULT['notification_email'], 'text', 0, 0, null, 40, $enable_email, 'spamx');
        $c->add('action', $_SPX_DEFAULT['action'], 'text', 0, 0, null, 50, false, 'spamx');
        $c->add('fs_sfs', NULL, 'fieldset', 0, 1, NULL, 0, true, 'spamx');
        $c->add('sfs_username_check', $_SPX_DEFAULT['sfs_username_check'], 'select', 0, 1, 1, 10, true, 'spamx');
        $c->add('sfs_email_check', $_SPX_DEFAULT['sfs_email_check'], 'select', 0, 1, 1, 20, true, 'spamx');
        $c->add('sfs_ip_check', $_SPX_DEFAULT['sfs_ip_check'], 'select', 0, 1, 1, 30, true, 'spamx');
        $c->add('sfs_username_confidence', $_SPX_DEFAULT['sfs_username_confidence'], 'text', 0, 1, 1, 40, true, 'spamx');
        $c->add('sfs_email_confidence', $_SPX_DEFAULT['sfs_email_confidence'], 'text', 0, 1, 1, 50, true, 'spamx');
        $c->add('sfs_ip_confidence', $_SPX_DEFAULT['sfs_ip_confidence'], 'text', 0, 1, 1, 60, true, 'spamx');
        $c->add('fs_slc', NULL, 'fieldset', 0, 2, NULL, 0, true, 'spamx');
        $c->add('slc_max_links', 5, 'text', 0, 1, 1, 10, true, 'spamx');
    }
    return true;
}
Example #17
0
 private static function execute($display = TRUE, $define = [], $assign = [])
 {
     if ($define) {
         self::define($define);
     }
     if ($assign) {
         self::assign($assign);
     }
     if (config::defined('template')) {
         $definition = config::import('template');
         if (gettype($definition) == "object" && $definition instanceof \Closure) {
             return $definition($display);
         }
     }
     // default
     $tpl = new view\php();
     $tpl->define(self::getDefine());
     $tpl->assign(self::getAssign());
     if ($define) {
         $tpl->define($define);
     }
     if ($assign) {
         $tpl->assign($assign);
     }
     return $tpl->show("layout", $display);
 }
Example #18
0
function polls_upgrade()
{
    global $_TABLES, $_CONF, $_PO_CONF;
    $currentVersion = DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name='polls'");
    switch ($currentVersion) {
        case '2.0.0':
        case '2.0.1':
        case '2.0.2':
        case '2.0.3':
        case '2.0.4':
        case '2.0.5':
        case '2.0.6':
        case '2.0.7':
        case '2.0.8':
        case '2.0.9':
        case '2.1.0':
            $c = config::get_instance();
            $c->add('displayblocks', 0, 'select', 0, 0, 13, 85, true, 'polls');
        case '2.1.1':
            DB_query("ALTER TABLE {$_TABLES['pollanswers']} CHANGE `pid` `pid` VARCHAR(128) NOT NULL DEFAULT '';", 1);
            DB_query("ALTER TABLE {$_TABLES['pollquestions']} CHANGE `pid` `pid` VARCHAR(128) NOT NULL;", 1);
            DB_query("ALTER TABLE {$_TABLES['polltopics']} CHANGE `pid` `pid` VARCHAR(128) NOT NULL;", 1);
            DB_query("ALTER TABLE {$_TABLES['pollvoters']} CHANGE `pid` `pid` VARCHAR(128) NOT NULL DEFAULT '';", 1);
        default:
            DB_query("UPDATE {$_TABLES['plugins']} SET pi_version='" . $_PO_CONF['pi_version'] . "',pi_gl_version='" . $_PO_CONF['gl_version'] . "' WHERE pi_name='polls' LIMIT 1");
            break;
    }
    if (DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name='polls'") == $_PO_CONF['pi_version']) {
        return true;
    } else {
        return false;
    }
}
Example #19
0
 public static function run()
 {
     if (!isset($_SERVER['REDIRECT_URL'])) {
         throw new Exception();
     }
     $_SERVER['REDIRECT_URL'] = substr($_SERVER['REDIRECT_URL'], strlen(config::prefix()));
     $path = explode('/', $_SERVER['REDIRECT_URL']);
     //array_shift($path);
     if ($path && preg_match('/^[0-9a-z]+$/i', $path[0])) {
         req::$controller = array_shift($path);
         if ($path && preg_match('/^[0-9a-z]+$/i', $path[0])) {
             req::$function = array_shift($path);
         }
     }
     unset($path);
     session::get_instance()->start();
     if (uuid::check(req::$controller)) {
         $obj = state::load(req::$controller);
         if (!$obj instanceof ctrl) {
             throw new Exception();
         }
         call_user_func(array($obj, req::$function));
     } else {
         $obj = eval('return new ' . req::$controller . '_ctrl();');
         if (!$obj instanceof ctrl) {
             throw new Exception();
         }
         util::redirect($obj, req::$function, $_GET);
     }
 }
 function render()
 {
     $current_user =& singleton("current_user");
     global $TPL;
     // Get averages for hours worked over the past fortnight and year
     $t = new timeSheetItem();
     $day = 60 * 60 * 24;
     //mktime(0,0,0,date("m"),date("d")-1, date("Y"))
     $today = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 1, date("Y")));
     $yestA = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 2, date("Y")));
     $yestB = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 1, date("Y")));
     $fortn = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 14, date("Y")));
     list($hours_sum_today, $dollars_sum_today) = $t->get_averages($today, $current_user->get_id());
     list($hours_sum_yesterday, $dollars_sum_yesterday) = $t->get_averages($yestA, $current_user->get_id(), null, $yestB);
     list($hours_sum_fortnight, $dollars_sum_fortnight) = $t->get_averages($fortn, $current_user->get_id());
     list($hours_avg_fortnight, $dollars_avg_fortnight) = $t->get_fortnightly_average($current_user->get_id());
     $TPL["hours_sum_today"] = sprintf("%0.2f", $hours_sum_today[$current_user->get_id()]);
     $TPL["dollars_sum_today"] = page::money_print($dollars_sum_today[$current_user->get_id()]);
     $TPL["hours_sum_yesterday"] = sprintf("%0.2f", $hours_sum_yesterday[$current_user->get_id()]);
     $TPL["dollars_sum_yesterday"] = page::money_print($dollars_sum_yesterday[$current_user->get_id()]);
     $TPL["hours_sum_fortnight"] = sprintf("%0.2f", $hours_sum_fortnight[$current_user->get_id()]);
     $TPL["dollars_sum_fortnight"] = page::money_print($dollars_sum_fortnight[$current_user->get_id()]);
     $TPL["hours_avg_fortnight"] = sprintf("%0.2f", $hours_avg_fortnight[$current_user->get_id()]);
     $TPL["dollars_avg_fortnight"] = page::money(config::get_config_item("currency"), $dollars_avg_fortnight[$current_user->get_id()], "%s%m %c");
     $TPL["dateFrom"] = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 28, date("Y")));
     $TPL["dateTo"] = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") + 1, date("Y")));
     return true;
 }
Example #21
0
 /**
  * Set the default image quality.
  *
  * @deprecated 3.2 Use the "GDBackend.default_quality" config setting instead
  * @param quality int A number from 0 to 100, 100 being the best quality.
  */
 public static function set_default_quality($quality)
 {
     Deprecation::notice('3.2', 'Use the "GDBackend.default_quality" config setting instead');
     if (is_numeric($quality) && (int) $quality >= 0 && (int) $quality <= 100) {
         config::inst()->update('GDBackend', 'default_quality', (int) $quality);
     }
 }
Example #22
0
 public function sendTemplate($keyword, $email, $tags = array(), $language = '')
 {
     loader::model('system/emailtemplates');
     if (!$language) {
         $language = config::item('language_id', 'system');
     }
     if (is_numeric($language)) {
         $language = config::item('languages', 'core', 'keywords', $language);
     } elseif (!in_array($language, config::item('languages', 'core', 'keywords'))) {
         return false;
     }
     if (!($template = config::item($keyword . '_' . $language, '_system_emails_cache'))) {
         if (!($template = $this->cache->item('core_email_template_' . $keyword . '_' . $language))) {
             $template = $this->emailtemplates_model->prepareTemplate($keyword, $language);
             if (count($template) == 3) {
                 if ($template[$keyword]['active']) {
                     $template = array('subject' => $template[$keyword]['subject'], 'message_html' => utf8::trim($template['header']['message_html'] . $template[$keyword]['message_html'] . $template['footer']['message_html']), 'message_text' => utf8::trim($template['header']['message_text'] . "\n\n" . $template[$keyword]['message_text'] . "\n\n" . $template['footer']['message_text']));
                 } else {
                     $template = 'none';
                 }
             } else {
                 error::show('Could not fetch email template from the database: ' . $keyword);
             }
             $this->cache->set('core_email_template_' . $keyword . '_' . $language, $template, 60 * 60 * 24 * 30);
         }
         config::set(array($keyword . '_' . $language => $template), '', '_system_emails_cache');
     }
     $retval = true;
     if (is_array($template) && $template) {
         $retval = $this->sendEmail($email, $template['subject'], $template['message_text'], $template['message_html'], $tags);
     }
     return $retval;
 }
Example #23
0
 /** 
  * 写日志 
  * 
  * @param string $s_message 日志信息 
  * @param string $s_type    日志类型 
  */
 public static function write($s_message, $s_type = 'log')
 {
     // 检查日志目录是否可写
     if (!is_dir(config::get("log_dir"))) {
         @mkdir(config::get("log_dir"));
         chmod(config::get("log_dir"), 0777);
     }
     if (!is_writable(config::get("log_dir"))) {
         throw new sfException(lang::get('LOG_PATH is not writeable !'));
     }
     $s_now_time = date('[Y-m-d H:i:s]');
     $s_now_day = date('Y_m_d');
     // 根据类型设置日志目标位置
     $s_target = config::get("log_dir");
     switch ($s_type) {
         case 'debug':
             $s_target .= '/Out_' . $s_now_day . '.log';
             break;
         case 'error':
             $s_target .= '/Err_' . $s_now_day . '.log';
             break;
         default:
             $s_target .= '/Log_' . $s_now_day . '.log';
             break;
     }
     //检测日志文件大小, 超过配置大小则重命名
     if (file_exists($s_target) && self::$max_size <= filesize($s_target)) {
         $s_file_name = substr(basename($s_target), 0, strrpos(basename($s_target), '.log')) . '_' . time() . '.log';
         rename($s_target, dirname($s_target) . '/' . $s_file_name);
     }
     clearstatcache();
     // 写日志, 返回成功与否
     return error_log("{$s_now_time} {$s_message}\n", 3, $s_target);
 }
Example #24
0
function update014()
{
    global $url, $smarty;
    //Checking if this Update already done
    if (CURRENT_DB_UPDATE < "014") {
        if (is_null(config::get('014updatestatus'))) {
            config::set('014updatestatus', 0);
        }
        $qry = DBFactory::getDBQuery(true);
        if (config::get('014updatestatus') < 1) {
            // Add killmail summary. time, hash, trust.
            $sql = 'CREATE TABLE IF NOT EXISTS `kb3_mails` (
  `kll_id` int(11) NOT NULL auto_increment,
  `kll_timestamp` datetime NOT NULL default "0000-00-00 00:00:00",
  `kll_external_id` int(8) default NULL,
  `kll_hash` BINARY(16) NOT NULL,
  `kll_trust` TINYINT NOT NULL DEFAULT 0,
  PRIMARY KEY  (`kll_id`),
  UNIQUE KEY `external_id` (`kll_external_id`),
  UNIQUE KEY `time_hash` (`kll_timestamp`,`kll_hash`)
) Engine=InnoDB';
            $qry->execute($sql);
        }
        killCache();
        config::set("DBUpdate", "014");
        $qry->execute("INSERT INTO kb3_config (cfg_site, cfg_key, cfg_value) SELECT cfg_site, 'DBUpdate', '014' FROM kb3_config GROUP BY cfg_site ON DUPLICATE KEY UPDATE cfg_value = '014'");
        config::del("014updatestatus");
        $smarty->assign('refresh', 1);
        $smarty->assign('content', "Update 014 completed.");
        $smarty->display('update.tpl');
        die;
    }
}
Example #25
0
function staticpages_upgrade()
{
    global $_TABLES, $_CONF, $_SP_CONF;
    $currentVersion = DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name='staticpages'");
    require_once $_CONF['path_system'] . 'classes/config.class.php';
    $c = config::get_instance();
    switch ($currentVersion) {
        case '1.5.0':
            $rc = update_150_to_151();
        case '1.5.1':
        case '1.5.2':
        case '1.5.3':
            DB_query("ALTER TABLE {$_TABLES['staticpage']} ADD sp_search tinyint(4) NOT NULL default '1' AFTER postmode", 1);
        case '1.5.4':
            DB_query("ALTER TABLE {$_TABLES['staticpage']} ADD sp_status tinyint(3) NOT NULL DEFAULT '1' AFTER sp_id");
            // static pages configuration options
            $c->add('include_search', 1, 'select', 0, 0, 0, 95, true, 'staticpages');
            $c->add('comment_code', -1, 'select', 0, 0, 17, 97, true, 'staticpages');
            $c->add('status_flag', 1, 'select', 0, 0, 13, 99, true, 'staticpages');
        case '1.6.0':
            DB_query("ALTER TABLE {$_TABLES['staticpage']} CHANGE `sp_tid` `sp_tid` VARCHAR(128) NOT NULL DEFAULT 'none';", 1);
        default:
            DB_query("UPDATE {$_TABLES['plugins']} SET pi_version='" . $_SP_CONF['pi_version'] . "',pi_gl_version='" . $_SP_CONF['gl_version'] . "' WHERE pi_name='staticpages' LIMIT 1");
            break;
    }
    if (DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name='staticpages'") == $_SP_CONF['pi_version']) {
        return true;
    } else {
        return false;
    }
}
Example #26
0
/**
* Initialize XMLSitemap plugin configuration
*
* Creates the database entries for the configuation if they don't already
* exist.  Initial values will be taken from $_XMLSMAP_DEFAULT.
*
* @return   boolean     true: success; false: an error occurred
*/
function plugin_initconfig_xmlsitemap()
{
    global $_XMLSMAP_DEFAULT;
    $me = 'xmlsitemap';
    $c = config::get_instance();
    if (!$c->group_exists($me)) {
        $c->add('sg_main', null, 'subgroup', 0, 0, null, 0, true, $me, 0);
        $c->add('tab_main', null, 'tab', 0, 0, null, 0, true, $me, 0);
        $c->add('fs_main', null, 'fieldset', 0, 0, null, 0, true, $me, 0);
        $c->add('sitemap_file', $_XMLSMAP_DEFAULT['sitemap_file'], 'text', 0, 0, null, 10, true, $me, 0);
        $c->add('mobile_sitemap_file', $_XMLSMAP_DEFAULT['mobile_sitemap_file'], 'text', 0, 0, null, 20, false, $me, 0);
        $c->add('types', $_XMLSMAP_DEFAULT['types'], '%text', 0, 0, null, 30, true, $me, 0);
        $c->add('exclude', $_XMLSMAP_DEFAULT['exclude'], '%text', 0, 0, null, 40, true, $me, 0);
        $c->add('lastmod', $_XMLSMAP_DEFAULT['lastmod'], '%text', 0, 0, null, 50, true, $me, 0);
        // Priorities
        $c->add('tab_pri', null, 'tab', 0, 1, null, 0, true, $me, 1);
        $c->add('fs_pri', null, 'fieldset', 0, 1, null, 0, true, $me, 1);
        $c->add('priorities', $_XMLSMAP_DEFAULT['priorities'], '*text', 0, 1, null, 50, true, $me, 1);
        // Frequencies
        $c->add('tab_freq', null, 'tab', 0, 2, null, 0, true, $me, 2);
        $c->add('fs_freq', null, 'fieldset', 0, 2, null, 0, true, $me, 2);
        $c->add('frequencies', $_XMLSMAP_DEFAULT['frequencies'], '@select', 0, 2, 20, 60, true, $me, 2);
        // Ping targets
        $c->add('tab_ping', null, 'tab', 0, 3, null, 0, true, $me, 3);
        $c->add('fs_ping', null, 'fieldset', 0, 3, null, 0, true, $me, 3);
        $c->add('ping_google', $_XMLSMAP_DEFAULT['ping_google'], 'select', 0, 3, 1, 100, true, $me, 3);
        $c->add('ping_bing', $_XMLSMAP_DEFAULT['ping_bing'], 'select', 0, 3, 1, 110, true, $me, 3);
    }
    return true;
}
Example #27
0
function polls_update_ConfValues_2_1_3()
{
    global $_CONF, $_PO_DEFAULT, $_PO_CONF, $_GROUPS, $_TABLES;
    require_once $_CONF['path_system'] . 'classes/config.class.php';
    $c = config::get_instance();
    require_once $_CONF['path'] . 'plugins/polls/install_defaults.php';
    $c->add('tab_poll_block', NULL, 'tab', 0, 20, NULL, 0, true, 'polls', 20);
    $c->add('fs_block_settings', NULL, 'fieldset', 0, 10, NULL, 0, true, 'polls', 20);
    $c->add('block_enable', $_PO_DEFAULT['block_enable'], 'select', 0, 10, 0, 10, true, 'polls', 20);
    $c->add('block_isleft', $_PO_DEFAULT['block_isleft'], 'select', 0, 10, 0, 20, true, 'polls', 20);
    $c->add('block_order', $_PO_DEFAULT['block_order'], 'text', 0, 10, 0, 30, true, 'polls', 20);
    $c->add('block_topic_option', $_PO_DEFAULT['block_topic_option'], 'select', 0, 10, 15, 40, true, 'polls', 20);
    $c->add('block_topic', $_PO_DEFAULT['block_topic'], '%select', 0, 10, NULL, 50, true, 'polls', 20);
    $c->add('fs_block_permissions', NULL, 'fieldset', 0, 20, NULL, 0, true, 'polls', 20);
    $new_group_id = 0;
    if (isset($_GROUPS['Polls Admin'])) {
        $new_group_id = $_GROUPS['Polls Admin'];
    } else {
        $new_group_id = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'Polls Admin'");
        if ($new_group_id == 0) {
            if (isset($_GROUPS['Root'])) {
                $new_group_id = $_GROUPS['Root'];
            } else {
                $new_group_id = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'Root'");
            }
        }
    }
    $c->add('block_group_id', $new_group_id, 'select', 0, 20, NULL, 10, TRUE, 'polls', 20);
    $c->add('block_permissions', $_PO_DEFAULT['block_permissions'], '@select', 0, 20, 14, 20, true, 'polls', 20);
    return true;
}
Example #28
0
/**
* Initialize Captcha plugin configuration
*
* Creates the database entries for the configuation if they don't already
* exist. Initial values will be taken from $_CA_CONF if available (e.g. from
* an old config.php), uses $_CP_DEFAULT otherwise.
*
* @return   boolean     true: success; false: an error occurred
*
*/
function plugin_initconfig_captcha()
{
    global $_CP_DEFAULT;
    $c = config::get_instance();
    if (!$c->group_exists('captcha')) {
        $c->add('sg_main', NULL, 'subgroup', 0, 0, NULL, 0, true, 'captcha', 0);
        $c->add('tab_main', NULL, 'tab', 0, 0, NULL, 0, true, 'captcha', 0);
        $c->add('fs_config', NULL, 'fieldset', 0, 0, NULL, 0, true, 'captcha', 0);
        $c->add('debug', $_CP_DEFAULT['debug'], 'select', 0, 0, 0, 50, true, 'captcha', 0);
        $c->add('logging', $_CP_DEFAULT['logging'], 'select', 0, 0, 0, 60, true, 'captcha', 0);
        $c->add('input_id', rand(), 'text', 0, 0, 0, 70, true, 'captcha', 0);
        $c->add('use_slider', 1, 'select', 0, 0, 0, 80, true, 'captcha', 0);
        $c->add('fs_integration', NULL, 'fieldset', 0, 10, NULL, 0, true, 'captcha', 0);
        $c->add('anonymous_only', $_CP_DEFAULT['anonymous_only'], 'select', 0, 10, 0, 10, true, 'captcha', 0);
        $c->add('remoteusers', $_CP_DEFAULT['remoteusers'], 'select', 0, 10, 0, 20, true, 'captcha', 0);
        $c->add('enable_comment', $_CP_DEFAULT['enable_comment'], 'select', 0, 10, 0, 40, true, 'captcha', 0);
        $c->add('enable_contact', $_CP_DEFAULT['enable_contact'], 'select', 0, 10, 0, 50, true, 'captcha', 0);
        $c->add('enable_emailstory', $_CP_DEFAULT['enable_emailstory'], 'select', 0, 10, 0, 60, true, 'captcha', 0);
        $c->add('enable_forum', $_CP_DEFAULT['enable_forum'], 'select', 0, 10, 0, 70, true, 'captcha', 0);
        $c->add('enable_registration', $_CP_DEFAULT['enable_registration'], 'select', 0, 10, 0, 80, true, 'captcha', 0);
        $c->add('enable_mediagallery', $_CP_DEFAULT['enable_mediagallery'], 'select', 0, 10, 0, 90, true, 'captcha', 0);
        $c->add('enable_rating', $_CP_DEFAULT['enable_rating'], 'select', 0, 10, 0, 100, true, 'captcha', 0);
        $c->add('enable_story', $_CP_DEFAULT['enable_story'], 'select', 0, 10, 0, 110, true, 'captcha', 0);
        $c->add('enable_calendar', $_CP_DEFAULT['enable_calendar'], 'select', 0, 10, 0, 120, true, 'captcha', 0);
        $c->add('enable_links', $_CP_DEFAULT['enable_links'], 'select', 0, 10, 0, 130, true, 'captcha', 0);
    }
    return true;
}
Example #29
0
 function createSelectBackground()
 {
     $options = array();
     if (config::get('style_background') == "0") {
         $state = 1;
     } else {
         $state = 0;
     }
     $options[] = array('value' => "0", 'descr' => "No background", 'state' => $state);
     $dir = "background/";
     if (is_dir($dir)) {
         if ($dh = scandir($dir)) {
             foreach ($dh as $file) {
                 $file = substr($file, 0);
                 if (!is_dir($dir . $file)) {
                     if (config::get('style_background') == $file) {
                         $state = 1;
                     } else {
                         $state = 0;
                     }
                     $options[] = array('value' => $file, 'descr' => $file, 'state' => $state);
                 }
             }
         }
     }
     return $options;
 }
Example #30
0
 public function login($username = null, $pass = null, $remember = false)
 {
     if (!$username && !$pass && $this->exist()) {
         Session::put($this->_sessionName, $this->data()->id);
     } else {
         $user = $this->find($username);
         if ($user) {
             if ($this->_data->password === Hash::make($pass, $this->_data->salt)) {
                 Session::put($this->_sessionName, $this->_data->id);
                 if ($remember) {
                     $hash = hash::unique();
                     $hashCheck = $this->_db->get('user_session', array('user_id', '=', $this->data()->id));
                     if (!$hashCheck->count()) {
                         $this->_db->insert('user_session', array('user_id' => $this->_data->id, 'hash' => $hash));
                     } else {
                         $hash = $hashCheck->first()->hash;
                     }
                     Cookies::put($this->_cookieName, $hash, config::get('remember/expiry'));
                 }
                 return true;
             }
         }
     }
     return false;
 }