示例#1
0
function UpdateUser($config, $id, $data)
{
    $rows = array();
    switch ($config['adapter']) {
        case 'Mysql':
            include '../modules/Application/src/Application/Model/Mysql/Execute.php';
            include '../modules/Application/src/Application/Model/Mysql/Connect.php';
            $link = Connect($config['slave']);
            $query = "UPDATE user SET ";
            foreach ($data as $key => $value) {
                echo "<pre>key:";
                print_r($key);
                echo "</pre>";
                echo "<pre>value:";
                print_r($value);
                echo "</pre>";
            }
            die;
            $rows = Execute($link, $query);
            break;
        case 'Txt':
            include '../modules/Application/src/Application/Model/Txt/Delete.php';
            $rows = Update($id, $data, $config['userfilename']);
            break;
    }
    return $rows;
}
function theme_clan($clanid)
{
    global $db, $dbtables, $theme_default;
    $_SESSION['theme'] = $theme_default;
    $res = $db - Execute("SELECT theme FROM {$dbtables['chiefs']} WHERE clanid='{$clanid}'");
    if (!$res->EOF) {
        if ($res->fields[theme] != "") {
            $_SESSION['theme'] = $res->fields[theme];
        }
    }
}
示例#3
0
function InsertUser($config, $data, $filename)
{
    $rows = array();
    switch ($config['adapter']) {
        case 'Mysql':
            include '../modules/Application/src/Application/Model/Mysql/Execute.php';
            include '../modules/Application/src/Application/Model/Mysql/Connect.php';
            $link = Connect($config['slave']);
            $query = 'INSERT INTO user (iduser, name, email, password, photo, description, bdate, city_idcity, gender_idgender) VALUES ' . '("4", "' . $data['name'] . '", "' . $data['email'] . '", "' . $data['password'] . '", "' . $_FILES['photo']['name'] . '", "' . $data['description'] . '", "' . $data['bdate'] . '", 1, 1)';
            $rows = Execute($link, $query);
            break;
        case 'Txt':
            include "../modules/Application/src/Application/Model/Txt/Insert.php";
            Insert($_POST, $filename);
            break;
    }
    // Obtener nombre de la imagen subida
    $_POST['photo'] = $_FILES['photo']['name'];
    // Comprobar si el nombre de archivo existe
    $dir = $_SERVER['DOCUMENT_ROOT'] . '/img/';
    $files = scandir($dir);
    if (in_array($_POST['photo'], $files)) {
        // Si existe se concatena con un numero
        // Comprobar si hay algun otro archivo con el mismo nombre y un numero concatenado
        $filtrado = "/" . substr($_POST['photo'], 0, -4) . "*/";
        $extension = substr($_POST['photo'], -3);
        $filesMatch = array();
        foreach ($files as $archivo) {
            $ext2 = substr($archivo, -3);
            if (preg_match($filtrado, $archivo) && $extension === $ext2) {
                $filesMatch[] = (int) substr($archivo, strrpos($archivo, "_") + 1, strlen($archivo));
            }
        }
        $filesMatchAux = range(1, max($filesMatch));
        $missing = array_diff($filesMatchAux, $filesMatch);
        if (count($missing) > 0) {
            $_POST['photo'] = substr($_POST['photo'], 0, -4) . '_' . min($missing) . '.' . $extension;
        } else {
            $_POST['photo'] = substr($_POST['photo'], 0, -4) . '_' . (max($filesMatch) + 1) . '.' . $extension;
        }
    }
    // Declarar destino donde guardar la imagen
    $destination = $_SERVER['DOCUMENT_ROOT'] . '/img/' . $_POST['photo'];
    // Pasarla de ruta temporal a ruta fisica en el servidor
    move_uploaded_file($_FILES['photo']['tmp_name'], $destination);
    return $rows;
}
示例#4
0
function DeleteUser($config, $id)
{
    $rows = array();
    switch ($config['adapter']) {
        case 'Mysql':
            include '../modules/Application/src/Application/Model/Mysql/Execute.php';
            include '../modules/Application/src/Application/Model/Mysql/Connect.php';
            $link = Connect($config['slave']);
            $query = "DELETE FROM user WHERE iduser=" . $id;
            $rows = Execute($link, $query);
            break;
        case 'Txt':
            include '../modules/Application/src/Application/Model/Txt/Delete.php';
            $rows = Delete($id, $config['userfilename']);
            break;
    }
    return $rows;
}
示例#5
0
function DeleteUser($config, $id)
{
    switch ($config['adapter']) {
        case 'Mysql':
            include "../modules/Application/src/Application/Model/Mysql/Connect.php";
            include "../modules/Application/src/Application/Model/Mysql/Execute.php";
            $master = $config['dbmaster'];
            $slave = $config['dbslave'];
            $link = Connect($master);
            $query = "DELETE FROM user WHERE iduser='******'";
            $data = Execute($query, $link);
            break;
        case 'Txt':
            include "../modules/Application/src/Application/Model/Txt/Delete.php";
            $data = Delete($config['filename'], $id);
            break;
    }
    return $data;
}
 function test()
 {
     ### Connect to the remote Db;
     $dbr =& NewADOConnection($this->type);
     $dbr->Connect($this->host, $this->user, $this->pass, $this->db);
     global $C_debug, $VAR;
     if (!empty($dbr->_errorMsg)) {
         $C_debug->alert('Failed: ' . $dbr->_errorMsg);
         $sql = "SELECT * FROM {$this->prefix}products";
         $rs = Execute($sql);
         if ($result === false) {
             $C_debug->alert('Failed: ' . $dbr->_errorMsg);
         }
     } else {
         $C_debug->alert('Connected OK!');
         # Write success to database
         $db =& DB();
         $id = $db->GenID(AGILE_DB_PREFIX . 'import_id');
         $sql = "INSERT INTO " . AGILE_DB_PREFIX . "import \n        \t\t\tSET\n        \t\t\tid \t\t\t= {$id},\n        \t\t\tsite_id \t= " . DEFAULT_SITE . ",\n        \t\t\tdate_orig\t= " . time() . ",\n\t\t\t\t\tplugin \t\t= " . $db->qstr($VAR['plugin']) . ",\n\t\t\t\t\taction \t\t= " . $db->qstr($VAR['action']);
         $db->Execute($sql);
     }
     # return to main import page
     echo "<script language=javascript>setTimeout('document.location=\\'?_page=import:import&plugin={$VAR['plugin']}\\'', 1500); </script>";
 }
示例#7
0
文件: txs.php 项目: x-clone/xsltforms
function Call($n)
{
    $xPar = new DOMDocument();
    $xPar->loadXML("<txs:args xmlns:txs=\"http://www.agencexml.com/txs\" filename=\"" . $n->getAttribute("filename") . "\"/>");
    for ($i = 0; $i < $n->childNodes->length; $i++) {
        $xPar->documentElement->appendChild($xPar->importNode($n->childNodes->item($i), true));
    }
    $res = Execute($n->getAttribute("filename"), $xPar->saveXML());
    $xRes = new DOMDocument();
    $xRes->loadXML($res);
    $n->parentNode->replaceChild($n->ownerDocument->importNode($xRes->documentElement, true), $n);
}
    CoherenceOffiels();
    die;
}
if ($argv[1] == "--compile") {
    compile();
    die;
}
if ($argv[1] == "--status") {
    BuildDatabaseStatus();
    die;
}
if ($argv[1] == "--refresh-index") {
    GET_MD5S_REMOTE();
    die;
}
Execute();
function build_progress($text, $pourc)
{
    ufdbevents("{$pourc}% {$text}");
    $GLOBALS["CACHEFILE"] = "/usr/share/artica-postfix/ressources/logs/web/toulouse-unversity.progress";
    WriteMyLogs("{$pourc}% {$text}", __FUNCTION__, __FILE__, __LINE__);
    $array["POURC"] = $pourc;
    $array["TEXT"] = $text;
    @file_put_contents($GLOBALS["CACHEFILE"], serialize($array));
    @chmod($GLOBALS["CACHEFILE"], 0755);
    if ($GLOBALS["OUTPUT"]) {
        echo "[{$pourc}%] {$text}\n";
        sleep(2);
    }
}
function ufdbevents($text = null)
示例#9
0
function populateFieldForSecurity($tabid, $fieldid)
{
    global $conn;
    $profileresult = $conn->query("select * from vtiger_profile");
    $countprofiles = $conn->num_rows($profileresult);
    for ($i = 0; $i < $countprofiles; $i++) {
        $profileid = $conn->query_result($profileresult, $i, 'profileid');
        $sqlProf2FieldInsert[$i] = 'insert into vtiger_profile2field values (' . $profileid . ',' . $tabid . ',' . $fieldid . ',0,1)';
        Execute($sqlProf2FieldInsert[$i]);
    }
    $def_query = "insert into vtiger_def_org_field values (" . $tabid . "," . $fieldid . ",0,1)";
    Execute($def_query);
}
示例#10
0
global $conn;
global $migrationlog;
$prefix = "vtiger_";
$migrationlog->debug("Inside the file rename_tables.php to rename the table names with prefix vtiger_");
//Rename all the tables with prefix vtiger_
$tables_list = $conn->get_tables();
foreach ($tables_list as $index => $tablename) {
    $sql = "rename table {$tablename} to {$prefix}{$tablename}";
    Execute($sql);
}
//Table renaming ends.
//In these following tablename => field we have to add the prefix vtiger_ as they are the tablenames
$change_cols_array = array("cvcolumnlist" => "columnname", "cvstdfilter" => "columnname", "cvadvfilter" => "columnname", "selectcolumn" => "columnname", "relcriteria" => "columnname", "reportsortcol" => "columnname", "reportdatefilter" => "datecolumnname", "reportsummary" => "columnname", "field" => "tablename");
foreach ($change_cols_array as $tablename => $columnname) {
    $result = $conn->query("select {$columnname} from {$prefix}{$tablename}");
    while ($row = $conn->fetch_row($result)) {
        if (!strstr($row[$columnname], $prefix) && $row[$columnname] != '' && $row[$columnname] != 'none') {
            //for reportsummary we should add prefix in second value ie., after first :(semicolon)
            if ($tablename == 'reportsummary') {
                $queries_list .= "update {$prefix}{$tablename} set {$columnname}=\"" . str_replace("cb:", "cb:{$prefix}", $row[$columnname]) . "\" where {$columnname}=\"{$row[$columnname]}\"&&##";
            } else {
                $queries_list .= "update {$prefix}{$tablename} set {$columnname}=\"{$prefix}{$row[$columnname]}\" where {$columnname}=\"{$row[$columnname]}\"&&##";
            }
        }
    }
}
$queries_array = explode("&&##", trim($queries_list, "&&##"));
foreach ($queries_array as $index => $query) {
    Execute($query);
}
$migrationlog->debug("End of file rename_tables.php. The table names renamed with prefix vtiger_");
示例#11
0
 function send_dcm($host, $port, $my_ae = 'DEANO', $remote_ae = 'DEANO', $send_batch = 0)
 {
     if (!$this->transfer_syntax) {
         $tags = new dicom_tag();
         $tags->file = $this->file;
         $tags->load_tags();
         $this->transfer_syntax = $tags->get_tag('0002', '0010');
     }
     $ts_flag = '';
     switch ($this->transfer_syntax) {
         case 'JPEGBaseline':
             $ts_flag = '-xy';
             break;
         case 'JPEGExtended:Process2+4':
             $ts_flag = '-xx';
             break;
         case 'JPEGLossless:Non-hierarchical-1stOrderPrediction':
             $ts_flag = '-xs';
             break;
     }
     $to_send = $this->file;
     if ($send_batch) {
         $to_send = dirname($this->file);
         $send_command = TOOLKIT_DIR . "/storescu -ta 10 -td 10 -to 10 {$ts_flag} -aet \"{$my_ae}\" -aec {$remote_ae} {$host} {$port} +sd \"{$to_send}\"";
     } else {
         $send_command = TOOLKIT_DIR . "/storescu -ta 10 -td 10 -to 10 {$ts_flag} -aet \"{$my_ae}\" -aec {$remote_ae} {$host} {$port} \"{$to_send}\"";
     }
     $out = Execute($send_command);
     if ($out) {
         return $out;
     }
     return 0;
 }
示例#12
0
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
define('TUBEX_CONTROL_PANEL', true);
require_once 'includes/cp-global.php';
// Send initial response headers
header("Content-type: text/html; charset: UTF-8");
NoCacheHeaders();
// Check for Firefox
$is_firefox = preg_match('~Firefox/~', $_SERVER['HTTP_USER_AGENT']);
if (Authenticate::Login()) {
    Execute(Request::Get('r'), 'tbxIndexShow');
} else {
    Growl::AddError(Authenticate::GetError());
    include_once 'cp-login.php';
}
function tbxVideoImportShow($errors = null)
{
    include_once 'cp-video-import.php';
}
function tbxVideoImportAnalyze()
{
    $v = Validator::Create();
    try {
        $file = Video_Import::ProcessSource($_REQUEST);
        $fields = Video_Import::Analyze(TEMP_DIR . '/' . $file, Request::Get('delimiter'));
    } catch (Exception $e) {
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
*
 ********************************************************************************/
global $conn;
//we have to get all customfields from customview and report related tables (cvcolumnlist, cvstdfilter, etc) and remove the entries from these tables if the customfields are not available in field table and cf table
$tables_array = array("vtiger_cvcolumnlist" => "columnname", "vtiger_cvstdfilter" => "columnname", "vtiger_cvadvfilter" => "columnname", "vtiger_selectcolumn" => "columnname", "vtiger_relcriteria" => "columnname", "vtiger_reportsortcol" => "columnname", "vtiger_reportdatefilter" => "datecolumnname", "vtiger_reportsummary" => "columnname");
foreach ($tables_array as $tablename => $columnname) {
    $query = "select {$columnname} from {$tablename} where {$columnname} like '%:cf_%'";
    $result = $conn->query($query);
    $noofrows = $conn->num_rows($result);
    for ($i = 0; $i < $noofrows; $i++) {
        //First get the fieldname from the result
        $col_value = $conn->query_result($result, $i, $columnname);
        $fieldname = substr($col_value, strpos($col_value, ':cf_') + 1, 6);
        //Now check whether this field is available in field table
        $sql1 = "select fieldid from vtiger_field where fieldname='" . $fieldname . "' and vtiger_field.presence in (0,2)";
        $result1 = $conn->query($sql1);
        $noofrows1 = $conn->num_rows($result1);
        $fieldid = $conn->query_result($result1, 0, "fieldid");
        //if there is no field then we have to delete that field entries
        if ($noofrows1 == 0 && !isset($fieldid)) {
            //Now we have to delete that customfield from the $tablename
            Execute("delete from {$tablename} where {$columnname} like '%:" . $fieldname . ":%'");
        }
    }
}
示例#14
0
文件: ajax.php 项目: hackingman/TubeX
#-------------------------------------------------------------------#
# TubeX - Copyright � 2009 JMB Software, Inc. All Rights Reserved.  #
# This file may not be redistributed in whole or significant part.  #
# TubeX IS NOT FREE SOFTWARE                                        #
#-------------------------------------------------------------------#
# http://www.jmbsoft.com/           http://www.jmbsoft.com/license/ #
#-------------------------------------------------------------------#
define('TUBEX_CONTROL_PANEL', true);
define('TUBEX_AJAX', true);
require_once 'includes/cp-global.php';
// Send initial response headers
header("Content-type: text/javascript; charset: UTF-8");
NoCacheHeaders();
if (Authenticate::Login()) {
    Execute(Request::Get('r'), 'tbxFunctionMissing');
} else {
    Growl::AddError(Authenticate::GetError());
    JSON::Logout();
}
function tbxVideoCommentDelete($comment)
{
    $DB = GetDB();
    $DB->Update('DELETE FROM `tbx_video_comment` WHERE `comment_id`=?', array($comment['comment_id']));
    if ($comment['status'] == STATUS_ACTIVE) {
        UpdateVideoCommentStats($comment, true);
    }
    return true;
}
function tbxVideoCommentApprove($comment)
{
示例#15
0
<?php

$afunction = function ($value) {
    echo $value;
};
function Execute($fun, $value)
{
    $fun($value);
}
Execute($afunction, 'hello');
$afunction('hello');
call_user_func($afunction, 'hello');
?>

<?php 
$print = function ($str) {
    echo $str;
};
function call($func)
{
    $func("hello");
}
call($print);
示例#16
0
function AddSession($Action, $Email)
{
    StartSession();
    $BrowserData = GetBrowserData();
    $AliID = hash('sha256', uniqid(rand(), true));
    $_SESSION["AliID"] = $AliID;
    $SessionIP = $BrowserData['IP'];
    $SessionBrowser = $BrowserData['Browser'];
    $SessionPlatform = $BrowserData['Platform'];
    global $PDOconn;
    $Query = 'CALL AddSession (?, ?, ?, ?, ?)';
    $Statement = $PDOconn->prepare($Query);
    $Statement->bindParam(1, $AliID, PDO::PARAM_STR, 64);
    $Statement->bindParam(2, $Email, PDO::PARAM_STR, 45);
    $Statement->bindParam(3, $SessionIP, PDO::PARAM_STR, 45);
    $Statement->bindParam(4, $SessionBrowser, PDO::PARAM_STR, 45);
    $Statement->bindParam(5, $SessionPlatform, PDO::PARAM_STR, 45);
    Execute($Action, $Statement);
}