Example #1
0
function signup($first_name, $last_name, $age, $email, $password)
{
    $sql = sprintf("SELECT user_id FROM user WHERE email = '%s'", $email);
    $exists = executeSql($sql);
    if (mysql_num_rows($exists) == 1) {
        return "exists";
    } else {
        $sql = sprintf("INSERT INTO user (first_name, last_name, age, email, password, receive_notifications, is_new, lang_id) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", $first_name, $last_name, $age, $email, md5($password), "0", "1", "1");
        return executeSql($sql);
    }
}
Example #2
0
 /**
  * [createTable 创建按天分表的表格 若不存在则新建 $table_yyyymmdd]
  * @param  [type] $tableName [description]
  * @param  [type] $prefix    [description]
  * @return [type]            [description]
  */
 public function createTable($tableName, $prefix)
 {
     //默认已经创建基表直接复制
     $basic = $tableName . "_basic";
     $tableName = $tableName . "_" . $prefix;
     $sql = "CREATE TABLE if not exists `" . $tableName . "` like {$basic}";
     // $this->mysqlConnect();
     // $ret = mysql_query($sql);
     $ret = executeSql($sql, false);
     return $tableName;
 }
Example #3
0
function setModuleUserProgress($user_id, $module_id, $progress, $is_complete, $date_completed)
{
    $module_already_added = isModuleAlreadyAdded($user_id, $module_id);
    if ($module_already_added) {
        return '{"status": "error", "message": "The user has already selected this module"}';
    } else {
        $sql = sprintf("INSERT INTO user_module (user_id, module_id, progress, is_complete, date_completed) VALUE ('%s', '%s', '%s', '%s', '%s')", $user_id, $module_id, $progress, $is_complete, $date_completed);
        $done = executeSql($sql);
        if ($done) {
            return '{"status": "ok", "message": "Module has been added successfully!", "module_id": ' . $module_id . '}';
        } else {
            return '{"status": "error", "message": "There was a problem while adding this module. Please try again later"}';
        }
    }
}
function saveBeaconData($uuid = null)
{
    $conf = new Conf();
    global $dbConnection;
    //db credentials
    $dbInfo['host'] = $conf->dbhost;
    $dbInfo['username'] = $conf->dbuser;
    $dbInfo['password'] = $conf->dbpass;
    $dbInfo['database'] = $conf->dbname;
    $dbInfo['port'] = $conf->dbport;
    $dbConnection = createDbConnection($dbInfo['host'], $dbInfo['username'], $dbInfo['password'], $dbInfo['database'], $dbInfo['port']);
    executeSql("UPDATE `hs_hr_config` SET `value` = '{$uuid}' WHERE `key` = 'beacon.uuid'");
    executeSql("UPDATE `hs_hr_config` SET `value` = 'on' WHERE `key` = 'beacon.activiation_status'");
    mysqli_close($dbConnection);
    return true;
}
Example #5
0
function saveBeaconData()
{
    include_once 'lib/confs/Conf.php';
    $conf = new Conf();
    global $dbConnection;
    //db credentials
    $dbInfo['host'] = $conf->dbhost;
    $dbInfo['username'] = $conf->dbuser;
    $dbInfo['password'] = $conf->dbpass;
    $dbInfo['database'] = $conf->dbname;
    $dbInfo['port'] = $conf->dbport;
    $dbConnection = createDbConnection($dbInfo['host'], $dbInfo['username'], $dbInfo['password'], $dbInfo['database'], $dbInfo['port']);
    if ($_POST['hearbeatSelect'] == 'on') {
        executeSql("UPDATE `hs_hr_config` SET `value` = 'on' WHERE `key` = 'beacon.activation_acceptance_status'");
    }
    $companyName = trim(addslashes($_POST['registerCompanyName']));
    executeSql("INSERT INTO `ohrm_organization_gen_info`(`name`) VALUES ('" . $companyName . "') ");
    mysqli_close($dbConnection);
    return true;
}
Example #6
0
function main()
{
    // Cria BD e tabela
    $db = new PDO("sqlite:teste.db");
    executeSql($db, "create table cadastro(nome varchar(80) not null primary key, nascimento text not null)");
    // Limpa a tabela eliminando registros existentes
    executeSql($db, "delete from cadastro");
    // Inclui linhas na tabela
    executeSql($db, "insert into cadastro values('Maria', '2010-01-21')");
    executeSql($db, "insert into cadastro values('José', '1995-10-09')");
    executeSql($db, "insert into cadastro values('Ada', '2011-07-15')");
    // Tentativa de incluir chave primária duplicada
    executeSql($db, "insert into cadastro values('Ada', '2011-11-12')");
    // Inclusão de valor de tipo diferente do configurado para a coluna
    executeSql($db, "insert into cadastro values('Eliseu', 3.1415)");
    // Atualiza dado de uma linha
    executeSql($db, "update cadastro set nome='Maria José' where nome='Maria'");
    // Mostra conteúdo da tabela
    imprimir($db);
}
Example #7
0
                JOIN faq_response AS fr ON
                    fr.FAQ_QuestionId = fq.Id
            WHERE MATCH(fr.Text) AGAINST(:searchQuery)
            ORDER BY fq.Text ASC
        ', ['searchQuery' => $searchQuery]);
    foreach ($answers as $answer) {
        if (!isset($resultQuestions[$answer->id])) {
            $resultQuestions[$answer->id] = ['id' => $answer->id, 'name' => $answer->text];
        }
    }
    $result = ['questions' => array_values($resultQuestions)];
    $app->response->headers->set('Content-Type', 'application/json');
    $app->response->write(json_encode($result));
});
$app->get('/questions/:id/answers', function ($id) use($app) {
    $answers = executeSql('
			SELECT
				fr.Id AS id,
				fr.Text AS text
			FROM faq_response AS fr
			WHERE fr.FAQ_QuestionId = :questionId
		', ['questionId' => $id]);
    $result = [];
    foreach ($answers as $answer) {
        $result[] = ['id' => $answer->id, 'text' => $answer->text];
    }
    $app->response->headers->set('Content-Type', 'application/json');
    $app->response->write(json_encode($result));
});
include_once 'expert_operations.php';
$app->run();
Example #8
0
                ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Zen Cart&trade; Installer</title>
<link rel="stylesheet" type="text/css" href="includes/templates/template_default/css/stylesheet.css">
</head>
<div id="wrap">
  <div id="header">
  <img src="includes/templates/template_default/images/zen_header_bg.jpg">
  </div>
<div class="progress" align="center">Installation In Progress...<br /><br />
<?php 
            }
            executeSql($_POST['db_type'] . '_zencart.sql', $_POST['db_name'], $_POST['db_prefix']);
            //update the cache folder setting:
            $sql = "update " . $_POST['db_prefix'] . "configuration set configuration_value='" . $_POST['sql_cache_dir'] . "' where configuration_key='SESSION_WRITE_DIRECTORY'";
            $db->Execute($sql);
            //update the phpbb setting:
            $sql = "update " . $_POST['db_prefix'] . "configuration set configuration_value='" . $_GET['use_phpbb'] . "' where configuration_key='PHPBB_LINKS_ENABLED'";
            $db->Execute($sql);
            $db->Close();
            // done - now onto next page for Store Setup (entries into database)
            if ($zc_show_progress == 'yes') {
                $linkto = 'index.php?main_page=store_setup&language=' . $language;
                $link = '<a href="' . $linkto . '">' . '<br /><br />Done!<br />Click Here To Continue<br /><br />' . '</a>';
                echo "\n<script type=\"text/javascript\">\nwindow.location=\"{$linkto}\";\n</script>\n";
                echo '<noscript>' . $link . '</noscript><br /><br />';
                echo '<div id="footer"><p>Copyright &copy; 2003, 2004, 2005 <a href="http://www.zen-cart.com" target="_blank">Zen Cart</a></p></div></div></body></html>';
            }
Example #9
0
 if (!$zc_install->fatal_error && isset($_POST['adminid']) && isset($_POST['adminpwd'])) {
     $zc_install->fileExists('sql/' . DB_TYPE . $sniffer_file, DB_TYPE . $sniffer_file . ' ' . ERROR_TEXT_DB_SQL_NOTEXIST, ERROR_CODE_DB_SQL_NOTEXIST);
     $zc_install->functionExists(DB_TYPE, ERROR_TEXT_DB_NOTSUPPORTED, ERROR_CODE_DB_NOTSUPPORTED);
     $zc_install->dbConnect(DB_TYPE, DB_SERVER, DB_DATABASE, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, ERROR_TEXT_DB_CONNECTION_FAILED, ERROR_CODE_DB_CONNECTION_FAILED, ERROR_TEXT_DB_NOTEXIST, ERROR_CODE_DB_NOTEXIST);
     $zc_install->verifyAdminCredentials($_POST['adminid'], $_POST['adminpwd']);
 }
 //end if !fatal_error
 if (ZC_UPG_DEBUG2 == true) {
     echo 'Processing [' . $sniffer_file . ']...<br />';
 }
 if ($zc_install->error == false && $nothing_to_process == false) {
     //open database connection to run queries against it
     $db = new queryFactory();
     $db->Connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE) or die("Unable to connect to database");
     // load the upgrade.sql file(s) relative to the required step(s)
     $query_results = executeSql('sql/' . DB_TYPE . $sniffer_file, DB_DATABASE, DB_PREFIX);
     if ($query_results['queries'] > 0 && $query_results['queries'] != $query_results['ignored']) {
         $messageStack->add('upgrade', $query_results['queries'] . '条指令成功执行。', 'success');
     } else {
         $messageStack->add('upgrade', '失败: ' . $query_results['queries'], 'error');
     }
     if (zen_not_null($query_results['errors'])) {
         foreach ($query_results['errors'] as $value) {
             $messageStack->add('upgrade-error-details', '忽略: ' . $value, 'error');
         }
     }
     if ($query_results['ignored'] != 0) {
         $messageStack->add('upgrade', '说明: ' . $query_results['ignored'] . '条指令未执行。详情查看 "upgrade_exceptions" 数据表。', 'caution');
     }
     /*           if (zen_not_null($query_results['output'])) {
                  foreach ($query_results['output'] as $value) {
Example #10
0
                     $messageStack->add('INFO: ' . $value, 'caution');
                 }
             }
         }
     } else {
         $messageStack->add(ERROR_NOTHING_TO_DO, 'error');
     }
     break;
 case 'uploadquery':
     $upload_query = file($_FILES['sql_file']['tmp_name']);
     $query_string = $upload_query;
     if (@get_magic_quotes_runtime() > 0) {
         $query_string = zen_db_prepare_input($upload_query);
     }
     if ($query_string != '') {
         $query_results = executeSql($query_string, DB_DATABASE, DB_PREFIX);
         if ($query_results['queries'] > 0 && $query_results['queries'] != $query_results['ignored']) {
             $messageStack->add($query_results['queries'] . ' statements processed.', 'success');
         } else {
             $messageStack->add('Failed: ' . $query_results['queries'], 'error');
         }
         if (zen_not_null($query_results['errors'])) {
             foreach ($query_results['errors'] as $value) {
                 $messageStack->add('ERROR: ' . $value, 'error');
             }
         }
         if ($query_results['ignored'] != 0) {
             $messageStack->add('Note: ' . $query_results['ignored'] . ' statements ignored. See "upgrade_exceptions" table for additional details.', 'caution');
         }
         if (zen_not_null($query_results['output'])) {
             foreach ($query_results['output'] as $value) {
Example #11
0
 function dbDemoDataInstall()
 {
     $this->dbActivate();
     // can likely remove this line for v1.4
     global $db;
     $db = $this->db;
     executeSql('demo/' . DB_TYPE . '_demo.sql', DB_DATABASE, DB_PREFIX);
 }
<?php

if (!mysql_num_rows(mysql_query("SHOW TABLES LIKE 'twitter'"))) {
    executeSql("plugins/tw/db.sql");
}
$sql = mysql_query("SELECT twiter FROM users");
if (!$sql) {
    mysql_query("ALTER TABLE users ADD twitter varchar(255) NOT NULL");
}
register_filter('index_icons', 'twitter_icon');
function twitter_icon($icons)
{
    return $icons . '<td align="center" width="14%" valign="top"><img src="60/twitter.png" alt="Get Twitter Followers"><br><b>Twitter Followers</b></td>';
}
register_filter('settings', 'twitter_settings');
function twitter_settings($settings)
{
    $user = mysql_query("SELECT twitter FROM `users` WHERE `username`='{$_SESSION['username']}'");
    $data = mysql_fetch_object($user);
    return $settings . 'Twitter<br/><input name="twitter" type="text" value="' . $data->twitter . '"><br/><br/>';
}
register_filter('settings_sumbit', 'twitter_settings_submit');
function twitter_settings_submit($settings)
{
    return $settings . ", `twitter` = '{$_POST['twitter']}'";
}
register_filter('top_menu_earn', 'twitter_top_menu');
function twitter_top_menu($menu)
{
    return $menu . "<li><a href='xchange.php?p=tw'>Twitter</a></li>";
}
<?php

if (!mysql_num_rows(mysql_query("SHOW TABLES LIKE 'surf'"))) {
    executeSql("plugins/surf/db.sql");
}
$sql = mysql_query("SELECT surftime FROM settings");
if (!$sql) {
    mysql_query("ALTER TABLE settings ADD surftime varchar(50) NOT NULL DEFAULT '10'");
}
register_filter('admin_settings', 'surf_settings');
function surf_settings($settings)
{
    $site = mysql_fetch_object(mysql_query("SELECT surftime FROM `settings`"));
    return $settings . 'Surf Time (2 - infinite)<br/><input name="surftime" type="text" value="' . $site->surftime . '"/><br/><br/>';
}
register_filter('admin_settings_post', 'surf_settings_post');
function surf_settings_post($settings)
{
    return $settings . ", `surftime`='{$_POST['surftime']}'";
}
register_filter('index_icons', 'surf_icon');
function surf_icon($icons)
{
    return $icons . '<td align="center" width="14%" valign="top"><img src="60/yelp.png" alt="Get Website Traffic"><br><b>Website Traffic</b></td>';
}
register_filter('top_menu_earn', 'surf_top_menu');
function surf_top_menu($menu)
{
    return $menu . "<li><a target='_blank' href='p.php?p=surf'>Surf</a></li>";
}
register_filter('site_menu', 'surf_site_menu');
Example #14
0
function getUserById($user_id)
{
    $sql = sprintf("SELECT user_id, first_name, last_name, age, email, receive_notifications, is_new, lang_id FROM user WHERE user_id = '%d'", $user_id);
    return executeSql($sql);
}
Example #15
0
function removeStepProgress($step_id, $user_id)
{
    $sql = sprintf("DELETE FROM user_step WHERE user_id = '%d' AND step_id = '%d'", $user_id, $step_id);
    return executeSql($sql);
}
Example #16
0
/**
 * 删除数据库
 *
 * @param resource $con 数据库连接
 * @param string $dbname 数据库名
 * @return array array($result, $info, $target)
 * $result 创建结果
 * $info 出错信息
 * $target 出错目标
 */
function dropDB($con, $dbname)
{
    $result = true;
    $info = '';
    $target = 'alert';
    $sql = 'DROP DATABASE `' . $dbname . '`';
    list($result, $infos) = executeSql($con, $sql);
    $info = implode("\n", $infos);
    $result = $result ? 0 : 1;
    return array($result, $info, $target);
}
 *
 * @param int $e_id id of the expert, e.g. 5023.
 *
 * @return json composed by questions sorted by most recent.
 */
$app->get('/get_recent_questions/:e_id', function ($e_id) use($app) {
    $recentQuestions = executeSql('
			SELECT faq_question.Id, faq_question.Text, faq_question.OccupationId, faq_question.DateCreated
			FROM faq_question
			INNER JOIN faq_questionassignment ON
				faq_questionassignment.FAQ_QuestionID = faq_question.Id
			WHERE faq_questionassignment.FAQ_ExpertID=:e_id
			ORDER BY DateCreated DESC;
        ', ['e_id' => $e_id]);
    $app->response->headers->set('Content-Type', 'application/json');
    $app->response->write(json_encode($recentQuestions));
});
/**
 * A function that will accept a like to to a specific response. (Ruben)
 *
 * @param int $e_id id of the expert, e.g. 5023.
 * @param int $r_id id of the response of another expert, e.g. 633491.
 *
 * @return none
 */
$app->get('/add_like_response/:e_id/:r_id', function ($e_id, $r_id) use($app) {
    executeSql('
        	INSERT INTO faq_responserating (`FAQ_ResponseId`, `FAQ_ExpertId`)
			VALUES (:r_id, :e_id)
        ', ['e_id' => $e_id, 'r_id' => $r_id]);
});
<?php

if (!mysql_num_rows(mysql_query("SHOW TABLES LIKE 'linkedin'"))) {
    executeSql("plugins/li/db.sql");
}
register_filter('index_icons', 'linkedin_icon');
function linkedin_icon($icons)
{
    return $icons . '<td align="center" width="14%" valign="top"><img src="60/linkedin.png" alt="Get Linkedin Shares"><br><b>Linkedin Shares</b></td>';
}
register_filter('top_menu_earn', 'linkedin_top_menu');
function linkedin_top_menu($menu)
{
    return $menu . "<li><a href='xchange.php?p=li'>Linkedin</a></li>";
}
register_filter('site_menu', 'linkedin_site_menu');
function linkedin_site_menu($menu)
{
    $selected = "";
    if (isset($_GET["p"]) && $_GET["p"] == "li") {
        $selected = "class='selected'";
    } else {
        $selected = "href='sites.php?p=li'";
    }
    return $menu . "<a {$selected}>Linkedin</a>";
}
register_filter('li_info', 'linkedin_info');
function linkedin_info($type)
{
    if ($type == "db") {
        return "linkedin";
Example #19
0
         }
     }
 }
 // 安装演示数据
 if (isset($_SESSION['extData']) && $_SESSION['extData'] == md5('extData')) {
     $sqlData = file_get_contents(PATH_ROOT . './install/data/installExtra.sql');
     $search = array('{time}', '{time1}', '{time2}', '{date}', '{date+1}');
     $replace = array(time(), strtotime('-1 hour'), strtotime('+1 hour'), strtotime(date('Y-m-d')), strtotime('-1 day', strtotime(date('Y-m-d'))));
     $sql = str_replace($search, $replace, $sqlData);
     executeSql($sql);
     unset($_SESSION['extData']);
 }
 // 安装工作流数据
 if (getIsInstall('workflow')) {
     $sqlFlowData = file_get_contents(PATH_ROOT . './install/data/installFlow.sql');
     executeSql($sqlFlowData);
 }
 session_destroy();
 $cacheArr = array('AuthItem', 'CreditRule', 'Department', 'Ipbanned', 'Nav', 'NotifyNode', 'Position', 'PositionCategory', 'Setting', 'UserGroup');
 foreach ($cacheArr as $cache) {
     CacheUtil::update($cache);
 }
 CacheUtil::load('usergroup');
 // 要注意小写
 CacheUtil::update('Users');
 // 因为用户缓存要依赖usergroup缓存,所以放在最后单独更新
 file_put_contents(PATH_ROOT . 'data/install.lock', '');
 $configfile = CONFIG_PATH . 'config.php';
 $config = (require $configfile);
 include 'extInfo.php';
 exit;
Example #20
0
function isTaskAlreadyAdded($user_id, $task_id)
{
    $sql = sprintf("SELECT user_task_id FROM user_task WHERE user_id = %d AND task_id = %d", $user_id, $task_id);
    $exists = executeSql($sql);
    return mysql_num_rows($exists);
}
Example #21
0
/**
 * 执行模块安装
 * @param string $moduleName 模块名
 * @return boolean 安装成功与否
 */
function install($moduleName)
{
    global $coreModules, $sysDependModule;
    defined('IN_MODULE_ACTION') or define('IN_MODULE_ACTION', true);
    $installPath = getInstallPath($moduleName);
    // 安装模块模型(如果有)
    $modelSqlFile = $installPath . 'model.sql';
    if (file_exists($modelSqlFile)) {
        $modelSql = file_get_contents($modelSqlFile);
        executeSql($modelSql);
    }
    // 处理模块配置,写入数据
    $config = (require $installPath . 'config.php');
    $icon = MODULE_PATH . $moduleName . '/static/image/icon.png';
    if (is_file($icon)) {
        $config['param']['icon'] = 1;
    } else {
        $config['param']['icon'] = 0;
    }
    if (!isset($config['param']['category'])) {
        $config['param']['category'] = '';
    }
    if (isset($config['param']['indexShow']) && isset($config['param']['indexShow']['link'])) {
        $config['param']['url'] = $config['param']['indexShow']['link'];
    } else {
        $config['param']['url'] = '';
    }
    $configs = json_encode($config);
    $record = array('module' => $moduleName, 'name' => $config['param']['name'], 'url' => $config['param']['url'], 'category' => $config['param']['category'], 'version' => $config['param']['version'], 'description' => $config['param']['description'], 'icon' => $config['param']['icon'], 'config' => $configs, 'installdate' => time());
    if (in_array($moduleName, $coreModules)) {
        $record['iscore'] = 1;
    } elseif (in_array($moduleName, $sysDependModule)) {
        $record['iscore'] = 2;
    } else {
        $record['iscore'] = 0;
    }
    $insertStatus = Yii::app()->db->createCommand()->insert('{{module}}', $record);
    return $insertStatus;
}
Example #22
0
function saveSKRHistory($indicator, $prevdata, $nextdata, $remark, $rlogID, $table, $id)
{
    $sql1 = "INSERT INTO skr_history (sh_indicator, sh_prev_data, sh_new_data, sh_remark, sh_rlog_id, sh_table, sh_table_id, sh_tkh_upd)\n\tVALUES('{$indicator}', '{$prevdata}', '{$nextdata}', '{$remark}', '{$rlogID}', '{$table}', '{$id}', now())";
    echo executeSql($sql1);
}
Example #23
0
 $store_country = zen_db_prepare_input($_POST['store_country']);
 $store_zone = zen_db_prepare_input($_POST['store_zone']);
 $store_address = zen_db_prepare_input($_POST['store_address']);
 $store_default_language = zen_db_prepare_input($_POST['store_default_language']);
 $store_default_currency = zen_db_prepare_input($_POST['store_default_currency']);
 $zc_install->isEmpty($store_name, ERROR_TEXT_STORE_NAME_ISEMPTY, ERROR_CODE_STORE_NAME_ISEMPTY);
 $zc_install->isEmpty($store_owner, ERROR_TEXT_STORE_OWNER_ISEMPTY, ERROR_CODE_STORE_OWNER_ISEMPTY);
 $zc_install->isEmpty($store_owner_email, ERROR_TEXT_STORE_OWNER_EMAIL_ISEMPTY, ERROR_CODE_STORE_OWNER_EMAIL_ISEMPTY);
 $zc_install->isEmail($store_owner_email, ERROR_TEXT_STORE_OWNER_EMAIL_NOTEMAIL, ERROR_CODE_STORE_OWNER_EMAIL_NOTEMAIL);
 $zc_install->isEmpty($store_address, ERROR_TEXT_STORE_ADDRESS_ISEMPTY, ERROR_CODE_STORE_ADDRESS_ISEMPTY);
 if ($_POST['demo_install'] == 'true') {
     $zc_install->fileExists('demo/' . DB_TYPE . '_demo.sql', ERROR_TEXT_DEMO_SQL_NOTEXIST, ERROR_CODE_DEMO_SQL_NOTEXIST);
 }
 if ($zc_install->error == false) {
     if ($_POST['demo_install'] == 'true') {
         executeSql('demo/' . DB_TYPE . '_demo.sql', DB_DATABASE, DB_PREFIX);
     }
     $sql = "update " . DB_PREFIX . "configuration set configuration_value = '" . $db->prepare_input($store_name) . "' where configuration_key = 'STORE_NAME'";
     $db->Execute($sql);
     $sql = "update " . DB_PREFIX . "configuration set configuration_value = '" . $db->prepare_input($store_owner) . "' where configuration_key = 'STORE_OWNER'";
     $db->Execute($sql);
     $sql = "update " . DB_PREFIX . "configuration set configuration_value = '" . $db->prepare_input($store_owner_email) . "' where configuration_key in \r\n             ('STORE_OWNER_EMAIL_ADDRESS','EMAIL_FROM','SEND_EXTRA_ORDER_EMAILS_TO','SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO','SEND_EXTRA_LOW_STOCK_EMAILS_TO',\r\n              'SEND_EXTRA_GV_CUSTOMER_EMAILS_TO','SEND_EXTRA_GV_ADMIN_EMAILS_TO','SEND_EXTRA_DISCOUNT_COUPON_ADMIN_EMAILS_TO','SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO', 'SEND_EXTRA_TELL_A_FRIEND_EMAILS_TO', 'SEND_EXTRA_REVIEW_NOTIFICATION_EMAILS_TO')";
     $db->Execute($sql);
     $sql = "update " . DB_PREFIX . "configuration set configuration_value = '" . $db->prepare_input($store_country) . "' where configuration_key = 'STORE_COUNTRY'";
     $db->Execute($sql);
     $sql = "update " . DB_PREFIX . "configuration set configuration_value = '" . $db->prepare_input($store_zone) . "' where configuration_key = 'STORE_ZONE'";
     $db->Execute($sql);
     $sql = "update " . DB_PREFIX . "configuration set configuration_value = '" . $db->prepare_input($store_address) . "' where configuration_key = 'STORE_NAME_ADDRESS'";
     $db->Execute($sql);
     $sql = "update " . DB_PREFIX . "configuration set configuration_value = '" . $db->prepare_input($store_default_language) . "' where configuration_key = 'DEFAULT_LANGUAGE'";
     $db->Execute($sql);
<?php

if (!mysql_num_rows(mysql_query("SHOW TABLES LIKE 'youtube'"))) {
    executeSql("plugins/yt/db.sql");
}
register_filter('index_icons', 'youtube_icon');
function youtube_icon($icons)
{
    return $icons . '<td align="center" width="14%" valign="top"><img src="60/youtube.png" alt="Get Youtube Views"><br><b>Youtube Views</b></td>';
}
register_filter('top_menu_earn', 'youtube_top_menu');
function youtube_top_menu($menu)
{
    return $menu . "<li><a href='xchange.php?p=yt'>Youtube</a></li>";
}
register_filter('site_menu', 'youtube_site_menu');
function youtube_site_menu($menu)
{
    $selected = "";
    if (isset($_GET["p"]) && $_GET["p"] == "yt") {
        $selected = "class='selected'";
    } else {
        $selected = "href='sites.php?p=yt'";
    }
    return $menu . "<a {$selected}>Youtube</a>";
}
register_filter('yt_info', 'youtube_info');
function youtube_info($type)
{
    if ($type == "db") {
        return "youtube";
Example #25
0
function updateProfile($user_id, $first_name, $last_name, $age)
{
    $sql = sprintf("UPDATE user SET first_name = '%s', last_name = '%s', age = '%s' WHERE user_id = %d", $first_name, $last_name, $age, $user_id);
    return executeSql($sql);
}
<?php

if (!mysql_num_rows(mysql_query("SHOW TABLES LIKE 'googleplus'"))) {
    executeSql("plugins/gp/db.sql");
}
register_filter('index_icons', 'googleplus_icon');
function googleplus_icon($icons)
{
    return $icons . '<td align="center" width="14%" valign="top"><img src="60/google.png" alt="Get Google Plus"><br><b>Google Plus</b></td>';
}
register_filter('top_menu_earn', 'googleplus_top_menu');
function googleplus_top_menu($menu)
{
    return $menu . "<li><a href='xchange.php?p=gp'>Google Plus</a></li>";
}
register_filter('site_menu', 'googleplus_site_menu');
function googleplus_site_menu($menu)
{
    $selected = "";
    if (isset($_GET["p"]) && $_GET["p"] == "gp") {
        $selected = "class='selected'";
    } else {
        $selected = "href='sites.php?p=gp'";
    }
    return $menu . "<a {$selected}>Google Plus</a>";
}
register_filter('gp_info', 'googleplus_info');
function googleplus_info($type)
{
    if ($type == "db") {
        return "googleplus";
Example #27
0
            WHERE MATCH(fr.Text) AGAINST(:searchQuery)
            HAVING isAnswered = 1
            ORDER BY fq.Text ASC
        ', ['searchQuery' => $searchQuery]);
    foreach ($answers as $answer) {
        if (!isset($resultQuestions[$answer->id])) {
            $resultQuestions[$answer->id] = ['id' => $answer->id, 'name' => $answer->text];
        }
    }
    $result = ['questions' => array_values($resultQuestions)];
    $app->response->headers->set('Content-Type', 'application/json');
    $app->response->write(json_encode($result));
});
$app->get('/questions/:id/answers', function ($id) use($app) {
    $answers = executeSql('
			SELECT
				fr.Id AS id,
				fr.Text AS text
			FROM faq_response AS fr
				JOIN faq_responsefaq_question AS frq ON
					frq.FAQ_Response_Id = fr.Id
			WHERE frq.FAQ_Question_Id = :questionId
		', ['questionId' => $id]);
    $result = [];
    foreach ($answers as $answer) {
        $result[] = ['id' => $answer->id, 'text' => $answer->text];
    }
    $app->response->headers->set('Content-Type', 'application/json');
    $app->response->write(json_encode($result));
});
$app->run();
<?php

if (!mysql_num_rows(mysql_query("SHOW TABLES LIKE 'facebook'"))) {
    executeSql("plugins/fb/db.sql");
}
register_filter('index_icons', 'facebook_icon');
function facebook_icon($icons)
{
    return $icons . '<td align="center" width="14%" valign="top"><img src="60/facebook.png" alt="Get Facebook Likes"><br><b>Facebook Likes</b></td>';
}
register_filter('top_menu_earn', 'facebook_top_menu');
function facebook_top_menu($menu)
{
    return $menu . "<li><a href='xchange.php?p=fb'>Facebook</a></li>";
}
register_filter('site_menu', 'facebook_site_menu');
function facebook_site_menu($menu)
{
    $selected = "";
    if (isset($_GET["p"]) && $_GET["p"] == "fb") {
        $selected = "class='selected'";
    } else {
        $selected = "href='sites.php?p=fb'";
    }
    return $menu . "<a {$selected}>Facebook</a>";
}
register_filter('fb_info', 'facebook_info');
function facebook_info($type)
{
    if ($type == "db") {
        return "facebook";
Example #29
0
function transferReviewsToOhrm()
{
    $sql = "SELECT * FROM `hs_hr_performance_review`";
    $result = executeSql($sql);
    while ($row = mysqli_fetch_array($result)) {
        $reviewId = $row['id'];
        $employeeId = $row['employee_id'];
        $reviewerId = $row['reviewer_id'];
        $jobTitleCode = $row['job_title_code'];
        $subDivisionId = $row['sub_division_id'];
        $creationDate = $row['creation_date'];
        $periodFrom = $row['period_from'];
        $periodTo = $row['period_to'];
        $dueDate = $row['due_date'];
        $state = $row['state'];
        $kpis = $row['kpis'];
        $stateId = getStateId($state);
        if ($stateId == 4) {
            $completedDate = $dueDate;
        } else {
            $completedDate = 'NULL';
        }
        if ($stateId >= 2) {
            $activatedDate = $creationDate;
        } else {
            $activatedDate = 'NULL';
        }
        executeSql("INSERT INTO `ohrm_performance_review`(`id`, `status_id`, `employee_number`, `work_period_start`, `work_period_end`, `job_title_code`, `department_id`, `due_date`, `completed_date`, `activated_date`) VALUES" . "(" . escapeString($reviewId) . ", " . escapeString($stateId) . "," . escapeString($employeeId) . "," . escapeString($periodFrom) . "," . escapeString($periodTo) . "," . escapeString($jobTitleCode) . "," . escapeString($subDivisionId) . "," . escapeString($dueDate) . "," . escapeString($completedDate) . "," . escapeString($activatedDate) . ")");
        if ($stateId >= 2) {
            transferKpisToReviewer($reviewId, $reviewerId, $state, $completedDate, $kpis);
        }
    }
}
Example #30
0
function main()
{
    $requisicao = json_decode(file_get_contents("php://input"));
    $sql = "";
    $resposta = "";
    $num_elementos = 0;
    switch ($_SERVER["REQUEST_METHOD"]) {
        case "DELETE":
        case "POST":
        case "PUT":
            $is_logged = isLogged();
            if (!$is_logged[0]) {
                // print encode(false, null, "É necessário se logar no Facebook!");
                print encode(false, null, $is_logged[1]);
                return;
            }
    }
    switch ($_SERVER["REQUEST_METHOD"]) {
        case "DELETE":
            $sql = "delete from t_notas_2 where id = :par1";
            $resposta = executeSql($sql, $_SERVER["REQUEST_METHOD"], $requisicao->id);
            break;
        case "GET":
            $pagina = 1;
            $elementosPorPagina = 1;
            if (isset($_GET["pagina"])) {
                $pagina = $_GET["pagina"];
            }
            if (isset($_GET["elementosPorPagina"])) {
                $elementosPorPagina = $_GET["elementosPorPagina"];
            }
            $inicio = $elementosPorPagina * ($pagina - 1);
            $sql = "select * from t_notas_2 order by tstamp desc\n          offset :par1 limit :par2";
            $dados = executeSql($sql, $_SERVER["REQUEST_METHOD"], $inicio, $elementosPorPagina);
            if ($dados[0]) {
                $rows = $dados[1];
                $msg = $dados[2];
                $sql = "select count(id) from t_notas_2";
                $dados = executeSql($sql, $_SERVER["REQUEST_METHOD"]);
                if ($dados[0]) {
                    $resposta = array(true, $rows, $msg);
                    $num_elementos = $dados[1][0]["count"];
                    break;
                }
            }
            $resposta = array(false, array(), $dados[2], 0);
            break;
        case "POST":
            $sql = "insert into t_notas_2(texto) values(:par1)";
            $resposta = executeSql($sql, $_SERVER["REQUEST_METHOD"], $requisicao->texto);
            break;
        case "PUT":
            $sql = "update t_notas_2 set texto = :par1 where id = :par2";
            $resposta = executeSql($sql, $_SERVER["REQUEST_METHOD"], $requisicao->texto, $requisicao->id);
            break;
        default:
            print encode(false, null, "Requisição inválida: " . $_SERVER["REQUEST_METHOD"]);
            return;
    }
    print encode($resposta[0], $resposta[1], $resposta[2], $num_elementos);
}