Пример #1
0
 public function __construct()
 {
     $this->coderoot = dirname(__FILE__) . '/' . __CLASS__ . '/';
     parent::__construct();
     if (!Sql_Table_exists($GLOBALS['table_prefix'] . 'restapi_request_log')) {
         saveConfig(md5('plugin-restapi-initialised'), false, 0);
         $this->initialise();
     }
 }
Пример #2
0
function processRequest()
{
    @header('Content-type: application/json');
    $action = getRequestParameter("action");
    $token = getRequestParameter("token");
    if ($action == 'getAllDemos') {
        $maxItems = getRequestParameter("maxItems");
        $userEmail = getRequestParameter("userEmail");
        logUsage($action, "", $maxItems, $userEmail);
        echo json_encode(getAllConfigsFromDatabase($userEmail, $maxItems));
    } else {
        if ($action == 'getStandardDemos') {
            logUsage($action, "", "", "");
            echo json_encode(getDefaultConfigsFromDatabase());
        } else {
            if ($action == 'saveConfig') {
                $config = getRequestParameter("config");
                $savedConfig = saveConfig(json_decode($config));
                logUsage($action, "", $savedConfig->token, $config);
                echo json_encode($savedConfig);
            } else {
                if ($action == 'copyConfig') {
                    // copy token config to a new token
                    // copy website...
                    $newToken = copyConfig($token);
                    logUsage($action, "", $newToken, "");
                    echo json_encode($newToken);
                } else {
                    if ($action == 'getConfig') {
                        logUsage($action, "", $token, "");
                        echo json_encode(getConfig($token));
                    } else {
                        // display how to use service.
                        $endpointVariables = array("Name" => "token", "Type" => "String", "Mandatory" => false);
                        $serviceEndpoints = array(array("Name" => "Reset Demo", "Description" => "....", "Endpoint" => "/api?action=resetDemo&token=...", "Variables" => $endpointVariables), array("Name" => "Get Configuration", "Description" => "....", "Endpoint" => "/api?action=getConfig[&token=...]"), array("Name" => "Save Configuration", "Description" => "....", "Endpoint" => "/api?action=saveConfig&config=..."), array("Name" => "Get Offers", "Description" => "....", "Endpoint" => "/api?action=getOffers&customer=...&maxOffer=...&token=..."), array("Name" => "Respond to Offer", "Description" => "....", "Endpoint" => "/api?action=respondToOffer&offer=...&customer=...&token=..."), array("Name" => "Get History", "Description" => "....", "Endpoint" => "/api?action=getHistory&customer=...&token=..."));
                        $serviceEndpointDesc = array("Service Endpoints" => $serviceEndpoints);
                        echo json_encode($serviceEndpointDesc);
                    }
                }
            }
        }
    }
    // log usage
    return;
}
Пример #3
0
        break;
    case "remove":
        removeComments($cid, $option);
        break;
    case "publish":
        publishComments($cid, 1, $option);
        break;
    case "unpublish":
        publishComments($cid, 0, $option);
        break;
    case "settings":
        showConfig($option);
        break;
    case "savesettings":
        $allow_comments_in_sections = implode(',', $_POST['mcselections']);
        saveConfig($option, $auto_publish_comments, $allow_anonymous_entries, $notify_new_entries, $allow_comments_in_sections, $comments_per_page, $admin_comments_length);
        break;
    default:
        showComments($option);
        break;
}
/**
 * @param option
 * @return list of comments
 */
function showComments($option)
{
    global $database, $mainframe;
    $limit = $mainframe->getUserStateFromRequest("viewlistlimit", 'limit', 10);
    $limitstart = $mainframe->getUserStateFromRequest("view{$option}limitstart", 'limitstart', 0);
    $search = $mainframe->getUserStateFromRequest("search{$option}", 'search', '');
Пример #4
0
        } else {
            echo "No password defined. ";
            $ok = false;
        }
    }
    // default values for the other parameters saved in config.php
    $config["zfurl"] = $_POST['zfurl'];
    $config["subtag"] = ZF_HOMETAG;
    $config["refreshmode"] = ZF_REFRESHMODE;
    $config["template"] = ZF_TEMPLATE;
    $config["displayerror"] = ZF_DISPLAYERROR;
    $config["encoding"] = ZF_ENCODING;
    $config["locale"] = ZF_LOCALE;
    $config["pubdateformat"] = ZF_PUBDATEFORMAT;
    $config["dateformat"] = ZF_DATEFORMAT;
    if ($ok && saveConfig($config)) {
        displayStatus('Basic configuration saved.');
        echo '<br/>Please go to the <a href="index.php?zfaction=config">configuration page</a> to complete the installation<br/><br/>';
        echo 'For security reasons, make sure to delete the file <code>install.php</code><br/><br/>';
        echo 'Have a look at the <a href="embed-demo.php">Embed demo page</a> to embed feeds on your site.';
    } else {
        echo "Cannot continue the installation";
        displayStatus('Configuration NOT saved.');
    }
    echo '</div>';
}
//phpinfo();
?>
</body>
</html>
Пример #5
0
$subselect .= '(category is null or category = "")';
$categories = listCategories();
if (!sizeof($categories)) {
    ## try to fetch them from existing lists
    $req = Sql_Query(sprintf('select distinct category from %s where category != "" ', $tables['list']));
    while ($row = Sql_Fetch_Row($req)) {
        array_push($categories, $row[0]);
    }
    if (!sizeof($categories)) {
        print '<p>' . s('No list categories have been defined') . '</p>';
        print '<p>' . s('Once you have set up a few categories, come back to this page to classify your lists with your categories.') . '</p>';
        print '<p>' . PageLinkButton('configure&id=list_categories', $I18N->get('Configure Categories')) . '</p>';
        print '<br/>';
        return;
    } else {
        saveConfig('list_categories', join(',', $categories));
    }
}
if (!empty($_POST['category']) && is_array($_POST['category'])) {
    foreach ($_POST['category'] as $key => $val) {
        Sql_Query(sprintf('update %s set category = "%s" %s and id = %d ', $tables['list'], sql_escape($val), $subselect, $key));
    }
    print Info($I18N->get('Categories saved'));
}
$req = Sql_Query(sprintf('select * from %s %s', $tables['list'], $subselect));
if (!Sql_Affected_Rows()) {
    print Info(s('All lists have already been assigned a category'), true);
} else {
    print '<div class="fright">' . PageLinkButton('configure&id=list_categories', $I18N->get('Configure Categories')) . '</div>';
}
$ls = new WebblerListing(s('Categorise lists'));
<!-- Start #main -->
<div id="main">			
	<div class="content">	
		<div class="content-header">
			<h4><a href="?p=admin">Main Menu</a> / Site Config</h4>
		</div> <!-- .content-header -->				
		<div class="main-content">					
		<?php 
if (isset($_POST['task'])) {
    if ($_POST['task'] == 'saveconfig') {
        saveConfig();
    }
}
?>
			<div class="mini-nav" style="width: 98%;">
				<table>
					<thead>
						<th  style="background: #FFD;"><center>Sub - Navigation</center></th>
					</thead>
				</table>
				<p>
					<center>
						| <a href="#basic">Basic Settings</a> |
						<a href="#config">Site Configuration</a> |
						<a href="#lang">Language Settings</a> |
						<a href="#acct">Account & Register Settings</a> |
						<a href="#fp">Frontpage Settings</a> |
						<br />
						| <a href="#email">Email Settings</a> |
						<a href="#paypal">Paypal Settings</a> |
						<a href="#module">In-Built Module Settings</a> |
Пример #7
0
	$tpl=new templates();
	$ERROR_NO_PRIVS=$tpl->javascript_parse_text("{ERROR_NO_PRIVS}");
	echo "alert('$ERROR_NO_PRIVS');";
	die();
	
}

	if(isset($_GET["popup"])){popup();exit;}
	if(isset($_GET["index"])){index();exit;}
	if(isset($_GET["settings"])){parameters();exit;}
	if(isset($_GET["dnsbl"])){dnsbl();exit;}
	if(isset($_GET["dnsbl-list"])){dnsbl_list();exit;}
	if(isset($_GET["dnsbl-add"])){dnsbl_add();exit;}
	if(isset($_GET["dnsbl-delete"])){dnsbl_delete();exit;}
	if(isset($_GET["postscreen_dnsbl_action"])){saveConfig();exit;}
	if(isset($_GET["postscreen_bare_newline_enable"])){saveConfig();exit;}
	
	
	
	if(isset($_GET["EnablePostScreen"])){EnablePostScreen_edit();exit;}

js();



function js(){
	$page=CurrentPageName();
	$title="PostScreen::{$_GET["hostname"]}/{$_GET["ou"]}";
	echo "YahooWin3(660,'$page?popup=yes&hostname={$_GET["hostname"]}&ou={$_GET["ou"]}','$title');";
	}
	
Пример #8
0
 }
 if (isset($_POST['getOrderDetail'])) {
     $query = pdoQuery('user_order_view', null, array('o_id' => $_POST['o_id']), '');
     foreach ($query as $row) {
         $detail[] = $row;
     }
     echo json_encode($detail);
 }
 if (isset($_POST['changeCateHome'])) {
     $configPath = $GLOBALS['mypath'] . '/mobile/config/config.json';
     pdoUpdate('category_tbl', array('remark' => $_POST['stu']), array('id' => $_POST['id']));
     $query = pdoQuery('category_tbl', array('count(*) as num'), array('remark' => 'home'), null);
     $num = $query->fetch();
     $config = getConfig($configPath);
     $config['cateWidth'] = 100 / $num['num'] < 20 ? 20 : 100 / $num['num'];
     saveConfig($configPath, $config);
     echo 'ok';
     exit;
 }
 if (isset($_POST['add_sc_parm'])) {
     for ($i = 25; $i > 0; $i--) {
         $colList[] = 'col' . $i;
     }
     $colQuery = pdoQuery('par_col_tbl', array('col_name'), array('sc_id' => $_POST['sc_id']), null);
     $colExist = array();
     foreach ($colQuery as $row) {
         $colExist[] = $row['col_name'];
     }
     $namePool = array_diff($colList, $colExist);
     $col_name = array_pop($namePool);
     //        mylog($col_name);
Пример #9
0
}
$categories = listCategories();
if (!count($categories)) {
    ## try to fetch them from existing lists
    $req = Sql_Query(sprintf('select distinct category from %s where category != "" ', $tables['list']));
    while ($row = Sql_Fetch_Row($req)) {
        array_push($categories, $row[0]);
    }
    if (!count($categories)) {
        print '<p>' . s('No list categories have been defined') . '</p>';
        print '<p>' . s('Once you have set up a few categories, come back to this page to classify your lists with your categories.') . '</p>';
        print '<p>' . PageLinkButton('configure&id=list_categories&ret=catlists', $I18N->get('Configure Categories')) . '</p>';
        print '<br/>';
        return;
    } else {
        saveConfig('list_categories', implode(',', $categories));
    }
}
if (!empty($_POST['category']) && is_array($_POST['category'])) {
    foreach ($_POST['category'] as $key => $val) {
        Sql_Query(sprintf('update %s set category = "%s" %s and id = %d ', $tables['list'], sql_escape($val), $subselect, $key));
    }
    if (isset($_GET['show']) && $_GET['show'] == 'all') {
        $_SESSION['action_result'] = s('Category assignments saved');
        Redirect('list');
    } else {
        Info(s('Categories saved'), true);
    }
}
$req = Sql_Query(sprintf('select * from %s %s', $tables['list'], $subselect));
if (!Sql_Affected_Rows()) {
Пример #10
0
 function updateDBtranslations($translations, $time, $language = '')
 {
     if (empty($language)) {
         $language = $this->language;
     }
     if (sizeof($translations)) {
         foreach ($translations as $orig => $trans) {
             Sql_Replace($GLOBALS['tables']['i18n'], array('lan' => $language, 'original' => $orig, 'translation' => $trans), '');
         }
     }
     $this->resetCache();
     saveConfig('lastlanguageupdate-' . $language, $time, 0);
 }
Пример #11
0
     setForumVariable($cid, 'published', 0);
     break;
 case "remove":
     deleteForum($cid, $option);
     break;
 case "orderup":
     orderForumUpDown($cid0, -1, $option);
     break;
 case "orderdown":
     orderForumUpDown($cid0, 1, $option);
     break;
 case "showconfig":
     showConfig($option);
     break;
 case "saveconfig":
     saveConfig($option);
     break;
 case "defaultconfig":
     defaultConfig($option);
     break;
 case "revertconfig":
     revertConfig($option);
     break;
 case "newmoderator":
     newModerator($option, $id);
     break;
 case "addmoderator":
     addModerator($option, $id, $cid, 1);
     break;
 case "removemoderator":
     addModerator($option, $id, $cid, 0);
Пример #12
0
<?php

## add default system template
## this should be part of the "UI theme"
print '<h2>Default system template</h2>';
$template = '<div style="margin:0; text-align:center; width:100%; background:#EEE;min-width:240px;height:100%;"><br />
    <div style="width:96%;margin:0 auto; border-top:6px solid #369;border-bottom: 6px solid #369;background:#DEF;" >
        <h3 style="margin-top:5px;background-color:#69C; font-weight:normal; color:#FFF; text-align:center; margin-bottom:5px; padding:10px; line-height:1.2; font-size:21px; text-transform:capitalize;">[SUBJECT]</h3>
        <div style="text-align:justify;background:#FFF;padding:20px; border-top:2px solid #369;min-height:200px;font-size:13px; border-bottom:2px solid #369;">[CONTENT]<div style="clear:both"></div></div>
        <div style="clear:both;background:#69C;font-weight:normal; padding:10px;color:#FFF;text-align:center;font-size:11px;margin:5px 0px">[FOOTER]<br/>[SIGNATURE]</div>
    </div>
<br /></div>';
$exists = Sql_Fetch_Row_Query(sprintf('select * from %s where title = "System Template"', $GLOBALS['tables']['template']));
if ($exists[0]) {
    print '<p>' . $GLOBALS['I18N']->get('The default system template already exists') . '</p>';
    print '<p>' . PageLinkButton('templates', $GLOBALS['I18N']->get('Go back to templates')) . '</p>';
} else {
    Sql_Query(sprintf('insert into %s (title,template,listorder) values("System Template","%s",0)', $GLOBALS['tables']['template'], addslashes($template)));
    $newid = Sql_Insert_Id();
    saveConfig('systemmessagetemplate', $newid);
    print '<p>' . $GLOBALS['I18N']->get('The default system template has been added as template with ID') . ' ' . $newid . ' </p>';
    print '<p>' . PageLinkButton('templates', $GLOBALS['I18N']->get('Go back to templates')) . '</p>';
    print '<p>' . PageLinkButton('template&amp;id=' . $newid, $GLOBALS['I18N']->get('Edit template')) . '</p>';
}
Пример #13
0
EndHTML;
//print "<pre>";      # DEBUG
//print_r($_SERVER);  # DEBUG
//print_r($_REQUEST); # DEBUG
//print "</pre>";     # DEBUG
#exit();
#Begin Perquisite Array 	(Needed files/directories with write access)
$dir_array = array('', 'tmp', 'tmp/simplepie_cache', 'lib/', 'tmp/smarty/templates_c', 'tmp/smarty/cache', 'tmp/openidserver', 'lib/simplepie', 'lib/feedpressreview', 'config.php');
#end perquisite array
#Begin Global Options Array
$optionsInfo = array('CONF_USE_CRON_FOR_DB_CLEANUP' => array('title' => 'Use cron for DB cleanup', 'depend' => 'return 1;', 'message' => '&nbsp;'), 'GMAPS_HOTSPOTS_MAP_ENABLED' => array('title' => 'Google Maps Support', 'depend' => 'return 1;', 'message' => '&nbsp;'), 'LOG_CONTENT_DISPLAY' => array('title' => 'Log what content is displayed to users', 'depend' => 'return 1;', 'message' => '&nbsp;'));
$CONFIG_FILE = 'config.php';
$LOCAL_CONFIG_FILE = 'local.config.php';
if (!empty($config)) {
    # If not empty, save javascript 'config' variable to config.php file
    saveConfig($config);
}
### Read Configuration file. Keys and Values => define('FOO', 'BRAK');
# Use config.php if local.config.php does not exist
//if(!file_exists(WIFIDOG_ABS_FILE_PATH."$LOCAL_CONFIG_FILE"))
$contentArray = file(WIFIDOG_ABS_FILE_PATH . "{$CONFIG_FILE}");
//else
//  $contentArray = file(WIFIDOG_ABS_FILE_PATH."$LOCAL_CONFIG_FILE");
$configArray = array();
foreach ($contentArray as $line) {
    #print "$line<BR>"; # Debug
    if (preg_match("/^define\\((.+)\\);/", $line, $matchesArray)) {
        //echo '<pre>';print_r($matchesArray);echo '</pre>';
        list($key, $value) = explode(',', $matchesArray[1]);
        $pattern = array("/^'/", "/'\$/");
        $replacement = array('', '');
Пример #14
0
     break;
 case 'createConfig':
     $new_id = createNewsletter($cnx, $row_config_globale['table_listsconfig'], $_POST['newsletter_name'], $_POST['from'], $_POST['from_name'], $_POST['subject'], $_POST['header'], $_POST['footer'], $_POST['subscription_subject'], $_POST['subscription_body'], $_POST['welcome_subject'], $_POST['welcome_body'], $_POST['quit_subject'], $_POST['quit_body'], $_POST['preview_addr']);
     if ($new_id > 0) {
         $list_id = $new_id;
         $l = 'l';
     }
     break;
 case 'saveGlobalconfig':
     $smtp_host = isset($_POST['smtp_host']) ? $_POST['smtp_host'] : '';
     $smtp_auth = isset($_POST['smtp_auth']) ? $_POST['smtp_auth'] : 0;
     $smtp_login = isset($_POST['smtp_login']) ? $_POST['smtp_login'] : '';
     $smtp_pass = isset($_POST['smtp_pass']) ? $_POST['smtp_pass'] : '';
     $mod_sub = isset($_POST['mod_sub']) ? $_POST['mod_sub'] : 0;
     $timezone = isset($_POST['timezone']) ? $_POST['timezone'] : '';
     if (saveConfig($cnx, $_POST['table_config'], $_POST['admin_pass'], 50, $_POST['base_url'], $_POST['path'], $_POST['language'], $_POST['table_email'], $_POST['table_temp'], $_POST['table_listsconfig'], $_POST['table_archives'], $_POST['sending_method'], $smtp_host, $smtp_auth, $smtp_login, $smtp_pass, $_POST['sending_limit'], $_POST['validation_period'], $_POST['sub_validation'], $_POST['unsub_validation'], $_POST['admin_email'], $_POST['admin_name'], $_POST['mod_sub'], $_POST['table_sub'], $_POST['charset'], $_POST['table_track'], $_POST['table_send'], $_POST['table_sauvegarde'], $_POST['table_upload'])) {
         $configSaved = true;
         $row_config_globale = $cnx->SqlRow("SELECT * FROM {$table_global_config}");
     } else {
         $configSaved = false;
     }
     if ($_POST['file'] == 1) {
         $configFile = saveConfigFile($PMNL_VERSION, $_POST['db_host'], $_POST['db_login'], $_POST['db_pass'], $_POST['db_name'], $_POST['table_config'], $_POST['db_type'], $_POST['type_serveur'], $_POST['type_env'], $timezone);
         $forceUpdate = 1;
         include "include/config.php";
         unset($forceUpdate);
     }
     saveBounceFile($_POST['bounce_host'], $_POST['bounce_user'], $_POST['bounce_pass'], $_POST['bounce_port'], $_POST['bounce_service'], $_POST['bounce_option']);
     break;
 case 'subscriber_add':
     $add_addr = empty($_POST['add_addr']) ? "" : $_POST['add_addr'];
Пример #15
0
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
if (!defined('ZF_VER')) {
    exit;
}
if (!is_writable(ZF_CONFIGFILE)) {
    displayStatus('config.php is not writable (you cannot save changes)!');
}
if (isset($_POST['dosave']) && $_POST['dosave'] == 'Save') {
    if ($_POST['newpassword'] == $_POST['confirmpassword'] && $_POST['newpassword'] != '') {
        $_POST['adminpassword'] = crypt($_POST['newpassword']);
    } else {
        $_POST['adminpassword'] = ZF_ADMINPASS;
    }
    $_POST['zfurl'] = ZF_URL;
    if (saveConfig($_POST)) {
        displayStatus('Configuration saved.');
    } else {
        displayStatus('Configuration NOT saved.');
    }
} else {
    ?>

<div id="core">
	<form name="configform" action="<?php 
    echo $_SERVER['PHP_SELF'] . '?zfaction=config';
    ?>
" method="post">
		<div class="frame">
		<h2>General configuration</h2>
Пример #16
0
function setTcObjectComment($dev, $obj, $head, $body)
{
    if (!ctype_alnum($dev)) {
        dieErr("malformed dev");
    }
    $config = readConfig();
    if (!is_array($config[$dev])) {
        $config[$dev] = array();
    }
    if (strlen($head) == 0 && strlen($body) == 0) {
        if (is_array($config[$dev]["comments"])) {
            unset($config[$dev]["comments"][$obj]);
        }
    } else {
        if (!is_array($config[$dev]["comments"])) {
            $config[$dev]["comments"] = array();
        }
        $config[$dev]["comments"][$obj] = array($head, $body);
    }
    saveConfig($config);
}
Пример #17
0
             }
         }
         Sql_Query('use ' . $dbname);
         output($GLOBALS['I18N']->get('Upgrading the database to use UTF-8, please wait') . '<br/>');
         foreach ($dbtables as $dbtable) {
             set_time_limit(3600);
             output($GLOBALS['I18N']->get('Upgrading table ') . ' ' . $dbtable . '<br/>');
             Sql_Query(sprintf('alter table %s default charset utf8', $dbtable), 1);
         }
         foreach ($dbcolumns as $dbcolumn) {
             set_time_limit(600);
             output($GLOBALS['I18N']->get('Upgrading column ') . ' ' . $dbcolumn['COLUMN_NAME'] . '<br/>');
             Sql_Query(sprintf('alter table %s change column %s %s %s default character set utf8', $dbcolumn['TABLE_NAME'], $dbcolumn['COLUMN_NAME'], $dbcolumn['COLUMN_NAME'], $dbcolumn['COLUMN_TYPE']), 1);
         }
         output($GLOBALS['I18N']->get('upgrade to UTF-8, done') . '<br/>');
         saveConfig('UTF8converted', date('Y-m-d H:i'), 0);
     } else {
         print '<div class="error">' . s('Database requires converting to UTF-8.') . '<br/>';
         print s('However, there is too little diskspace for this conversion') . '<br/>';
         print s('Please do a manual conversion.') . ' ' . PageLinkButton('converttoutf8', s('Run manual conversion to UTF8'));
         print '</div>';
     }
 }
 ## 2.11.7 and up
 Sql_Query(sprintf('alter table %s add column privileges text', $tables['admin']), 1);
 Sql_Query('alter table ' . $tables['list'] . ' add column category varchar(255) default ""', 1);
 Sql_Query('alter table ' . $tables['user_attribute'] . ' change column value value text');
 Sql_Query('alter table ' . $tables['message'] . ' change column textmessage textmessage longtext');
 Sql_Query('alter table ' . $tables['message'] . ' change column message message longtext');
 Sql_Query('alter table ' . $tables['messagedata'] . ' change column data data longtext');
 Sql_Query('alter table ' . $tables['bounce'] . ' add index statusidx (status(20))', 1);
Пример #18
0
 function getConfig($item)
 {
     global $default_config, $domain, $website, $tables;
     if ($item != 'website' && isset($GLOBALS['config'][$item])) {
         return $GLOBALS['config'][$item];
     }
     /*
         if (!DEVSITE && isset($_SESSION['config'][$item])) {
           return $_SESSION['config'][$item];
         }
     */
     if (!isset($GLOBALS['config']) || !is_array($GLOBALS['config'])) {
         $GLOBALS['config'] = array();
     }
     if (empty($_SESSION['hasconf'])) {
         $hasconf = Sql_Table_Exists($tables["config"], 1);
         $_SESSION['hasconf'] = $hasconf;
     } else {
         $hasconf = $_SESSION['hasconf'];
     }
     $toget = $item;
     $value = '';
     if ($hasconf) {
         $query = ' select value,editable' . ' from ' . $tables['config'] . ' where item = ?';
         $req = Sql_Query_Params($query, array($toget));
         if (!Sql_Num_Rows($req) || !$hasconf) {
             if (isset($default_config[$item])) {
                 $value = $default_config[$item]['value'];
             }
             # save the default value to the database, so we can obtain
             # the information when running from commandline
             if (Sql_Table_Exists($tables["config"])) {
                 saveConfig($item, $value);
             }
             #    print "$item => $value<br/>";
         } else {
             $row = Sql_Fetch_Row($req);
             $value = $row[0];
             if (!empty($default_config[$item]['hidden'])) {
                 $GLOBALS['noteditableconfig'][] = $item;
             }
         }
     }
     $value = str_replace('[WEBSITE]', $website, $value);
     $value = str_replace('[DOMAIN]', $domain, $value);
     $value = str_replace('<?=VERSION?>', VERSION, $value);
     if (isset($default_config[$item]['type'])) {
         $type = $default_config[$item]['type'];
     } else {
         $type = "";
     }
     if ($type == "boolean") {
         if ($value == "0") {
             $value = "false";
         } elseif ($value == "1") {
             $value = "true";
         }
         ## cast to bool
         $value = $value == "true";
     }
     ## disallow single quotes in listcategories
     if ($item == 'list_categories') {
         $value = str_replace("'", " ", $value);
     }
     # if this is a subpage item, and no value was found get the global one
     if (!$value && strpos($item, ":") !== false) {
         list($a, $b) = explode(":", $item);
         $value = getConfig($a);
         $_SESSION['config'][$item] = $value;
         return $value;
     } else {
         $GLOBALS['config'][$item] = stripslashes($value);
         $_SESSION['config'][$item] = $GLOBALS['config'][$item];
         return $GLOBALS['config'][$item];
     }
 }
Пример #19
0
 public function updateDBtranslations($translations, $time, $language = '')
 {
     if (empty($language)) {
         $language = $this->language;
     }
     if (count($translations)) {
         foreach ($translations as $orig => $trans) {
             Sql_Query('replace into ' . $GLOBALS['tables']['i18n'] . ' (lan,original,translation) values("' . $language . '","' . sql_escape($orig) . '","' . sql_escape($trans) . '")');
         }
     }
     $this->resetCache();
     saveConfig('lastlanguageupdate-' . $language, $time, 0);
 }
Пример #20
0
function processRequest()
{
    @header('Content-type: application/json');
    $action = getRequestParameter("action");
    $token = getRequestParameter("token");
    if ($action == 'getAllDemos') {
        $maxItems = getRequestParameter("maxItems");
        $userEmail = getRequestParameter("userEmail");
        logUsage($action, "", $maxItems, $userEmail);
        echo json_encode(getAllConfigsFromDatabase($userEmail, $maxItems));
    } else {
        if ($action == 'getStandardDemos') {
            logUsage($action, "", "", "");
            echo json_encode(getDefaultConfigsFromDatabase());
        } else {
            if ($action == 'resetDemo') {
                resetDemo($token);
                logUsage($action, "", $token, "");
            } else {
                if ($action == 'saveConfig') {
                    $config = getRequestParameter("config");
                    $savedConfig = saveConfig(json_decode($config));
                    logUsage($action, "", $savedConfig->token, $config);
                    echo json_encode($savedConfig);
                } else {
                    if ($action == 'copyConfig') {
                        // copy token config to a new token
                        // copy website...
                        $newToken = copyConfig($token);
                        logUsage($action, "", $newToken, "");
                        echo json_encode($newToken);
                    } else {
                        if ($action == 'getOffers') {
                            $customer = getRequestParameter("customer");
                            $channel = getRequestParameter("channel");
                            $list_size = getRequestParameter("maxOffers");
                            $do_not_track = getRequestParameter("DoNotTrack");
                            logUsage($action, "", $token, $channel);
                            echo json_encode(getOffers($token, $customer, $channel, $list_size, $do_not_track));
                        } else {
                            if ($action == 'changeAnalyticsScore') {
                                $customer = getRequestParameter("customer");
                                $scoreIndex = getRequestParameter("scoreIndex");
                                $scoreValue = getRequestParameter("scoreValue");
                                echo json_encode(changeAnalyticsScore($token, $customer, $scoreIndex, $scoreValue));
                            } else {
                                if ($action == 'respondToOffer') {
                                    $customer = getRequestParameter("customer");
                                    $offerCd = getRequestParameter("offer");
                                    $responseCd = getRequestParameter("response");
                                    $channelCd = getRequestParameter("channel");
                                    $details = getRequestParameter("details");
                                    logUsage($action, "", $token, $channelCd);
                                    echo json_encode(respondToOffer($token, $customer, $offerCd, $responseCd, $channelCd, $details));
                                } else {
                                    if ($action == 'getHistory') {
                                        $customer = getRequestParameter("customer");
                                        logUsage($action, "", $token, $customer);
                                        echo json_encode(getCustomerHistory($token, $customer));
                                    } else {
                                        if ($action == 'getConfig') {
                                            logUsage($action, "", $token, "");
                                            echo json_encode(getConfig($token));
                                        } else {
                                            // display how to use service.
                                            $endpointVariables = array("Name" => "token", "Type" => "String", "Mandatory" => false);
                                            $serviceEndpoints = array(array("Name" => "Reset Demo", "Description" => "....", "Endpoint" => "/api?action=resetDemo&token=...", "Variables" => $endpointVariables), array("Name" => "Get Configuration", "Description" => "....", "Endpoint" => "/api?action=getConfig[&token=...]"), array("Name" => "Save Configuration", "Description" => "....", "Endpoint" => "/api?action=saveConfig&config=..."), array("Name" => "Get Offers", "Description" => "....", "Endpoint" => "/api?action=getOffers&customer=...&maxOffer=...&token=..."), array("Name" => "Respond to Offer", "Description" => "....", "Endpoint" => "/api?action=respondToOffer&offer=...&customer=...&token=..."), array("Name" => "Get History", "Description" => "....", "Endpoint" => "/api?action=getHistory&customer=...&token=..."));
                                            $serviceEndpointDesc = array("Service Endpoints" => $serviceEndpoints);
                                            echo json_encode($serviceEndpointDesc);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    // log usage
    return;
}
Пример #21
0
<?php 
require_once dirname(__FILE__) . '/accesscheck.php';
if (isset($_POST["default"]) && $_POST['default']) {
    saveConfig("defaultsubscribepage", $_POST["default"]);
}
if (isset($_POST['active']) && is_array($_POST['active'])) {
    Sql_Query(sprintf('update %s set active = 0', $GLOBALS['tables']['subscribepage']));
    foreach ($_POST['active'] as $sPageId => $active) {
        Sql_Query(sprintf('update %s set active = 1 where id = %d', $GLOBALS['tables']['subscribepage'], $sPageId));
    }
}
$default = getConfig("defaultsubscribepage");
$subselect = '';
if ($GLOBALS["require_login"] && !isSuperUser()) {
    $access = accessLevel("list");
    switch ($access) {
        case "owner":
            $subselect = " where owner = " . $_SESSION["logindetails"]["id"];
            break;
        case "all":
            $subselect = "";
            break;
        case "none":
        default:
            $subselect = " where id = 0";
            break;
    }
}
if (isset($_REQUEST['delete'])) {
    $delete = sprintf('%d', $_REQUEST['delete']);
Пример #22
0
<?php

require_once dirname(__FILE__) . '/accesscheck.php';
if (isset($_GET['delete'])) {
    # delete the index in delete
    $delete = sprintf('%d', $_GET['delete']);
    print $GLOBALS['I18N']->get('Deleting') . " {$delete} ...\n";
    $result = Sql_query("delete from " . $tables["template"] . " where id = {$delete}");
    $result = Sql_query("delete from " . $tables["templateimage"] . " where template = {$delete}");
    print "... " . $GLOBALS['I18N']->get('Done') . "<br /><hr /><br />\n";
}
if (isset($_POST['defaulttemplate'])) {
    saveConfig('defaultmessagetemplate', sprintf('%d', $_POST['defaulttemplate']));
}
if (isset($_POST['systemtemplate'])) {
    saveConfig('systemmessagetemplate', sprintf('%d', $_POST['systemtemplate']));
}
$req = Sql_Query("select * from {$tables["template"]} order by listorder");
if (!Sql_Affected_Rows()) {
    print '<p class="information">' . $GLOBALS['I18N']->get("No template have been defined") . '</p>';
}
$defaulttemplate = getConfig('defaultmessagetemplate');
$systemtemplate = getConfig('systemmessagetemplate');
print formStart('name="templates" class="templatesEdit" ');
$ls = new WebblerListing($GLOBALS['I18N']->get("Existing templates"));
while ($row = Sql_fetch_Array($req)) {
    $img_template = '<img src="images/no-image-template.png" />';
    if (file_exists('templates/' . $row['id'] . '.jpg')) {
        $img_template = '<img src="templates/' . $row['id'] . '.jpg" />';
    }
    $element = $row['title'];
Пример #23
0
    foreach ($plugins as $piName => $pi) {
        if (!pluginCanEnable($piName)) {
            unset($plugins[$piName]);
            $disabled_plugins[$piName] = 1;
        }
    }
    saveConfig('plugins_disabled', serialize($disabled_plugins), 0);
    saveConfig(md5('plugin-' . $disable . '-initialised'), 0);
    $status = $GLOBALS['img_cross'] . '<script type="text/javascript">document.location = document.location; </script>';
} elseif (isset($_GET['enable']) && !empty($GLOBALS['allplugins'][$_GET['enable']])) {
    if (pluginCanEnable($_GET['enable'])) {
        if (isset($disabled_plugins[$_GET['enable']])) {
            unset($disabled_plugins[$_GET['enable']]);
        }
        if (isset($GLOBALS['allplugins'][$_GET['enable']])) {
            $GLOBALS['allplugins'][$_GET['enable']]->initialise();
        }
        #  var_dump($disabled_plugins);
        saveConfig('plugins_disabled', serialize($disabled_plugins), 0);
        $status = $GLOBALS['img_tick'] . '<script type="text/javascript">document.location = document.location; </script>';
    } else {
        logEvent(s('Failed to enable plugin (%s), dependencies failed', clean($_GET['enable'])));
        $status = $GLOBALS['img_cross'];
    }
} elseif (isset($_GET['initialise'])) {
    if (isset($GLOBALS['plugins'][$_GET['initialise']])) {
        $status = $GLOBALS['plugins'][$_GET['initialise']]->initialise();
    }
}
#var_dump($_GET);
return $status;
Пример #24
0
<?php

require_once dirname(__FILE__) . '/accesscheck.php';
if (isset($_POST['default']) && $_POST['default']) {
    saveConfig('defaultsubscribepage', $_POST['default']);
}
if (isset($_POST['active']) && is_array($_POST['active'])) {
    Sql_Query(sprintf('update %s set active = 0', $GLOBALS['tables']['subscribepage']));
    foreach ($_POST['active'] as $sPageId => $active) {
        Sql_Query(sprintf('update %s set active = 1 where id = %d', $GLOBALS['tables']['subscribepage'], $sPageId));
    }
}
$default = getConfig('defaultsubscribepage');
$subselect = '';
if ($GLOBALS['require_login'] && !isSuperUser()) {
    $access = accessLevel('list');
    switch ($access) {
        case 'owner':
            $subselect = ' where owner = ' . $_SESSION['logindetails']['id'];
            break;
        case 'all':
            $subselect = '';
            break;
        case 'none':
        default:
            $subselect = ' where id = 0';
            break;
    }
}
if (isset($_REQUEST['delete'])) {
    $delete = sprintf('%d', $_REQUEST['delete']);
Пример #25
0
 function initialise()
 {
     global $table_prefix;
     $me = new ReflectionObject($this);
     $plugin_initialised = getConfig(md5('plugin-' . $me->getName() . '-initialised'));
     if (empty($plugin_initialised)) {
         foreach ($this->DBstruct as $table => $structure) {
             if (!Sql_Table_exists($table_prefix . $me->getName() . '_' . $table)) {
                 #  print s('Creating table').' '.$table . '<br/>';
                 Sql_Create_Table($table_prefix . $me->getName() . '_' . $table, $structure);
             }
         }
         saveConfig(md5('plugin-' . $me->getName() . '-initialised'), time(), 0);
     }
 }
Пример #26
0
/**
 * Check settings of language, config file, reloads list of databases and save result to configuration
 *
 * @return string String with checked and added databases
 */
function setDefaultConfig()
{
    global $config, $databases, $out, $lang, $dbo;
    // check language and fallback to englisch if language file is not readable
    $lang_file = './language/' . $config['language'] . '/lang.php';
    if (!file_exists($lang_file) || !is_readable($lang_file)) {
        $config['language'] = 'en';
    }
    include './language/' . $config['language'] . '/lang.php';
    getConfig($config['config_file']);
    // falls back to config mysqldumper if something is wrong
    // get list of databases for this user
    $dbUser = $dbo->getDatabases();
    foreach ($dbUser as $db) {
        // new found db?  -> add it
        if (!isset($databases[$db])) {
            $databases[$db] = array();
        }
    }
    ksort($databases);
    foreach ($databases as $db_name => $val) {
        if ($dbo->selectDb($db_name, true)) {
            addDatabaseToConfig($db_name);
            $out .= $lang['L_SAVING_DB_FORM'] . " " . $db_name . " " . $lang['L_ADDED'] . "\n";
        } else {
            unset($databases[$db_name]);
        }
    }
    saveConfig();
    return $out;
}
Пример #27
0
            $tpl->assign_block_vars('CONNECTION_OK', array('RESULT' => $dbDetect));
            if (count($databases) == 0) {
                $tpl->assign_block_vars('CONNECTION_OK_BUT_NO_DB', array());
            }
        }
    }
    $tpl->assign_vars(array('SESSION_ID' => session_id(), 'DB_HOST' => $config['dbhost'], 'DB_USER' => $config['dbuser'], 'DB_PASS' => $config['dbpass'], 'DB_MANUAL' => $config['dbmanual'], 'ICON_OK' => $icon['ok']));
    $tpl->pparse('show');
}
$_SESSION['config'] = $config;
$_SESSION['databases'] = $databases;
// Step 4: normally not visible - save checked config-params and redirect to
// start page of MySQLDumper
if ($phase == 3) {
    // save configuration with checked db-parameters
    $configSaved = saveConfig();
    if (!$configSaved) {
        // Ouch, although we checked everything before we now couldn't save
        // the config -> should never happen
        echo '<h6>MySQLDumper - ' . $lang['L_CONFBASIC'] . '</h6>';
        echo '<p class="warnung">Fatal Error: couldn\'t save configuration!!</p>';
    } else {
        // Everything is done - redirect to start screen of MySQLDumper
        echo '<script type="text/javascript">';
        echo 'self.location.href="index.php?MySQLDumper=' . session_id() . '"';
        echo '</script>';
    }
}
?>
</div>
</div>
Пример #28
0
<?php

require_once dirname(__FILE__) . '/accesscheck.php';
if (isset($_GET['delete'])) {
    # delete the index in delete
    $delete = sprintf('%d', $_GET['delete']);
    print $GLOBALS['I18N']->get('Deleting') . " {$delete} ...\n";
    $result = Sql_query("delete from " . $tables["template"] . " where id = {$delete}");
    $result = Sql_query("delete from " . $tables["templateimage"] . " where template = {$delete}");
    print "... " . $GLOBALS['I18N']->get('Done') . "<br /><hr /><br />\n";
}
if (isset($_POST['defaulttemplate'])) {
    saveConfig('defaultmessagetemplate', sprintf('%d', $_POST['defaulttemplate']));
}
?>

<script language="Javascript" src="js/jslib.js" type="text/javascript"></script>


<?php 
$req = Sql_Query("select * from {$tables["template"]} order by listorder");
if (!Sql_Affected_Rows()) {
    print '<p class="error">' . $GLOBALS['I18N']->get("No template have been defined") . '</p>';
}
$defaulttemplate = getConfig('defaultmessagetemplate');
print formStart('name="templates"');
$ls = new WebblerListing($GLOBALS['I18N']->get("Existing templates"));
while ($row = Sql_fetch_Array($req)) {
    $element = $row['title'];
    $ls->addElement($element, PageUrl2('template&id=' . $row['id']));
    $ls->addColumn($element, $GLOBALS['I18N']->get('ID'), $row['id']);
Пример #29
0
        print $LOG_FILE;
        break;
    case "Tune":
        $args = array("flag_training" => 0, "flag_tuning" => 1, "flag_recaser" => 0, "id" => $_POST["train_id"], "lm_factor" => $_POST["lm_factor"], "lm_order" => $_POST["lm_order"], "src" => $_POST["src_lang"], "target" => $_POST["tar_lang"], "corpus_training" => $_POST["train_corpus_name"], "corpus_tuning" => $_POST["tune_corpus_name"], "alignment" => $_POST["alignment"], "reordering" => $_POST["reordering"], "with_irstlm" => $_POST["irstlm"], "with_kenlm" => $_POST["kenlm"]);
        saveConfig(getTrainingConfigFullPath(), $args);
        MosesCmdRun(getTrainingScriptFullPath(), getTrainingConfigFullPath());
        print $LOG_FILE;
        break;
    case "Train+Tune":
        $args = array("flag_training" => 1, "flag_tuning" => 1, "flag_recaser" => 0, "id" => $_POST["train_id"], "lm_factor" => $_POST["lm_factor"], "lm_order" => $_POST["lm_order"], "src" => $_POST["src_lang"], "target" => $_POST["tar_lang"], "corpus_training" => $_POST["train_corpus_name"], "corpus_tuning" => $_POST["tune_corpus_name"], "alignment" => $_POST["alignment"], "reordering" => $_POST["reordering"], "with_irstlm" => $_POST["irstlm"], "with_kenlm" => $_POST["kenlm"]);
        saveConfig(getTrainingConfigFullPath(), $args);
        MosesCmdRun(getTrainingScriptFullPath(), getTrainingConfigFullPath());
        print $LOG_FILE;
        break;
    case "Evaluate":
        $args = array("id" => $_POST["train_id"], "flag_recaser" => $_POST["recasing"], "flag_evaluation" => $_POST["evaluate"], "src" => $_POST["src_lang"], "target" => $_POST["tar_lang"], "corpus_recaser" => $_POST["recase_corpus_name"], "corpus_eval_src" => $_POST["eval_src_corpus_name"], "corpus_eval_ref" => $_POST["eval_ref_corpus_name"], "corpus_eval_tst" => $_POST["eval_tst_corpus_name"], "evaluation_tool" => $_POST["evaluation_tool"]);
        saveConfig(getEvaluationConfigFullPath(), $args);
        MosesCmdRun(getEvaluationScriptFullPath(), getEvaluationConfigFullPath());
        print $LOG_FILE;
        break;
    case "getTrainingList":
        print getTrainingList($_POST["src_lang"], $_POST["tar_lang"]);
        break;
    case "getAllResults":
        print getEvalResults($_POST["src_lang"], $_POST["tar_lang"]);
        break;
    case "getResult":
        getLog($_POST["log_file"]);
        break;
}
return 0;
Пример #30
0
<?php

include_once "functions.php";
switch ($_REQUEST["do"]) {
    case 'save':
        # write to YAML file
        if (saveConfig($_POST["config"])) {
            $message = "Data has been saved: " . date("Ymd H:i:s");
            $messageClass = "success";
        } else {
            $message = "Could not save the data. Check your config and file permissions.";
            $messageClass = "error";
        }
        $formData = stripslashes($_POST["config"]);
        break;
    default:
        $formData = loadConfig('config.yml');
        break;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">

    <title>Reload infoboard rotator ADMINISTRATION</title>
    <meta name="description" content="">

    <meta name="viewport" content="width=device-width">
    <link rel="shortcut icon" href="http://reload.dk/favicon.ico">