Exemplo n.º 1
0
 public function listarResponsavel($id_aluno, $cod_situacao = 1)
 {
     $query = "\n            SELECT\n                pessoa.id_pessoa,\n                pessoa.id_escola,\n                pessoa.id_turma,\n                pessoa.tipo,\n                pessoa.data_inclusao,\n                pessoa.ultima_alteracao,\n                pessoa.nome,\n                pessoa.data_nascimento,\n                pessoa.genero,\n                pessoa.cpf_cnpj,\n                pessoa.valor_mensalidade,\n                pessoa.telefone1,\n                pessoa.telefone2,\n                pessoa.telefone3,\n                pessoa.telefone4,\n                pessoa.email1,\n                pessoa.email2,\n                pessoa.email3,\n                pessoa.email4,\n                pessoa.endereco,\n                pessoa.complemento,\n                pessoa.bairro,\n                pessoa.cidade,\n                pessoa.uf,\n                pessoa.cod_situacao\n            FROM pessoa\n            INNER JOIN aluno_responsavel ON aluno_responsavel.id_responsavel = pessoa.id_pessoa\n            WHERE aluno_responsavel.id_aluno = '" . do_escape($id_aluno) . "'\n            AND pessoa.cod_situacao = '" . do_escape($cod_situacao) . "'\n        ";
     $pessoas = array();
     $result = get_result_db($query);
     while ($pessoa = get_object($result)) {
         $pessoas[] = $this->atualizar($pessoa);
     }
     free_result($result);
     return $pessoas;
 }
Exemplo n.º 2
0
 public function listar($cod_situacao = null)
 {
     $query = $this->query() . "\n            WHERE usuario.id_escola = '" . do_escape(ID_ESCOLA) . "'\n        ";
     if (!is_null($cod_situacao)) {
         $query .= " AND usuario.cod_situacao = '" . do_escape($cod_situacao) . "' ";
     }
     $query .= " ORDER BY usuario.nome ";
     $usuarios = array();
     $result = get_result_db($query);
     while ($usuario = get_object($result)) {
         $usuarios[] = $this->atualizar($usuario);
     }
     free_result($result);
     return $usuarios;
 }
Exemplo n.º 3
0
 public function listar($id_usuario, $cod_situacao = 1)
 {
     $query = $this->query();
     $query .= " \n            WHERE id_usuario = '" . do_escape($id_usuario) . "'\n            AND cod_situacao = '" . do_escape($cod_situacao) . "'\n        ";
     $personagens = array();
     $result = get_result_db($query);
     while ($personagem = get_object($result)) {
         $personagens[] = $this->atualizar($personagem);
     }
     free_result($result);
     return $personagens;
 }
Exemplo n.º 4
0
 public static function listarItem($id_jogador = null)
 {
     $query = static::query();
     if (!is_null($id_jogador)) {
         $query .= " WHERE id_jogador = " . do_escape($id_jogador) . " ";
     }
     $query .= " ORDER BY nome";
     $itens = array();
     $result = get_result_db($query);
     while ($row = get_object($result)) {
         $itens[] = static::carregarDB($row);
     }
     free_result($result);
     return $itens;
 }
Exemplo n.º 5
0
function vis_structure($io, $prev_value, &$allSame)
{
    $id = $io['id'];
    $value = $io['value'];
    $ios = get_child_ios($id);
    $result = '';
    if (count($ios) == 0) {
        $result = vis_value($value, $prev_value, $allSame);
    } else {
        $childrenSame = true;
        $result2 = '';
        $result2 .= '<table class="table table-condensed">';
        $dttoMode = false;
        $dttoNames = '';
        foreach ($ios as $cio) {
            $childSame = true;
            $object = get_object($cio['object_id']);
            $result3 = '<tr><td>';
            $result3 .= get_object_link($object, $cio['name'], $cio['operation_id']);
            $result3 .= '</td><td>';
            $result3 .= render_value($cio, $object, $childSame);
            $result3 .= '</td></tr>';
            $childrenSame = $childrenSame && $childSame;
            if (!$childSame) {
                if ($dttoMode) {
                    $result2 .= "<tr><td title=\"These members are unchanged: {$dttoNames}\">&#x22ee;</td><td></td></tr>";
                    $dttoMode = false;
                    $dttoNames = '';
                }
                $result2 .= $result3;
            } else {
                $dttoMode = true;
                $dttoNames .= " " . htmlentities($cio['name']);
            }
        }
        $result2 .= '</table>';
        if ($childrenSame) {
            $result = dtto();
        } else {
            $allSame = false;
            $result = $result2;
        }
    }
    return $result;
}
Exemplo n.º 6
0
 public static function listar($limit = 0)
 {
     $query = static::query();
     $query .= "\n            WHERE (\n                sessao.id_mestre = '" . do_escape(ID_JOGADOR) . "' OR\n                " . do_escape(ID_JOGADOR) . " IN (\n                    SELECT personagem.id_jogador\n                    FROM personagem\n                    WHERE personagem.id_sessao = sessao.id_sessao\n                )\n            )\n            AND sessao.cod_situacao IN (" . SESSAO_ATIVA . "," . SESSAO_PAUSA . ")\n            ORDER BY sessao.ultimo_turno DESC\n        ";
     if ($limit > 0) {
         $query .= " LIMIT " . do_escape($limit);
     }
     $sessoes = array();
     $result = get_result_db($query);
     while ($dados = get_object($result)) {
         $sessao = new Sessao();
         static::carregar($sessao, $dados);
         $sessoes[] = $sessao;
     }
     free_result($result);
     return $sessoes;
 }
Exemplo n.º 7
0
function render_object($object_id, $operation_id)
{
    $object = get_object($object_id);
    $ios = get_io_for_object($object_id);
    $name = get_name_for_object($ios);
    echo '<h2>';
    home_btn();
    echo ' <span style="color: #ddd">' . htmlspecialchars($object['type']) . '</span> ' . htmlspecialchars($name) . '</h2>';
    echo '<table class="table table-condensed">';
    $prev_io = null;
    $was_write = false;
    $last_write = false;
    $allSame = false;
    $first = true;
    foreach ($ios as $io) {
        if ($io['readwrite'] == ReadWrite::Read) {
            if (!$was_write && $first) {
                echo "<tr class=\"error-no-write\"><td colspan=\"6\">Not clear who wrote this value</td></tr>";
            }
        }
        $result = '';
        if ($io['operation_id'] == $operation_id) {
            $result .= "<tr class=\"highlight\">";
        } else {
            $result .= "<tr>";
        }
        $result .= '<td>' . $io['id'] . '</td>';
        $result .= render_io($io, $allSame, 'operation', $name, $prev_io);
        $result .= "</tr>";
        if ($was_write && $io['readwrite'] == ReadWrite::Read && !$allSame) {
            echo "<tr class=\"error-no-write\"><td colspan=\"6\">Not sure where exactly this value changed</td></tr>";
        }
        echo $result;
        $prev_io = $io;
        $last_write = $io['readwrite'] == ReadWrite::Write;
        $was_write |= $last_write;
        $first = false;
    }
    if ($last_write) {
        echo "<tr class=\"error-no-write\"><td colspan=\"6\">Not clear who reads the value after this last write</td></tr>";
    }
    echo '</table>';
}
Exemplo n.º 8
0
 function deleteProject($pid)
 {
     connect_db();
     // delete the project from this array
     $id = array_search($pid, $this->projects);
     if ($id !== false) {
         array_splice($this->projects, $id, 1);
         update_object('Director', $this);
     }
     $proj = get_object('Project', $pid);
     if ($proj !== false) {
         $proj->cleanDelete();
     }
     //close_db();
 }
Exemplo n.º 9
0
function send_request()
{
    $u_id = $_SESSION['u_id'];
    if (!$_SESSION['friend_search_id']) {
        return 'no_friend_id';
    }
    $friend_id = $_SESSION['friend_search_id'];
    $sql = "SELECT req_id FROM friend_request \n            WHERE (req_u_id = {$u_id} and req_friend_id = {$friend_id}) \n            or (req_u_id = {$friend_id} and req_friend_id = {$u_id})";
    $result = get_object($sql);
    if ($result) {
        return 'request_exist';
    }
    $sql = "INSERT INTO friend_request (req_u_id, req_friend_id) VALUES ({$u_id}, {$friend_id})";
    insert($sql);
    $_SESSION['friend_search_id'] = null;
    return 'request_was_sent';
}
Exemplo n.º 10
0
 function my_download_object()
 {
     $bucket_name = 'download bucket';
     $object_name = 'download object';
     $options = array(ALIOSS::OSS_FILE_DOWNLOAD => "download path", ALIOSS::OSS_RANGE => '0-1');
     $response = $client > get_object($bucket_name, $object_name, $options);
 }
Exemplo n.º 11
0
function get_object_exit($db_name, $table_name, $base_name)
{
    $res = get_object($db_name, $table_name, $base_name);
    if (empty($res)) {
        jsonp_nocache_exit(array('status' => 'error', 'error' => $base_name . ' object not exists.'));
    }
    return $res;
}
Exemplo n.º 12
0
<?php

$_POST['ssid'] = $_GET['ssid'];
require '../session.php';
require 'edit_function.php';
// Clear the url temp for the ID TEMP
$_SESSION[$ssid]['objet_fiche']->clear_url_temp();
// Parse the URL & insert params in database
$object_type = get_object();
$object_id = get_object_id();
$object_version = get_object_version($_SESSION[$ssid]['message']['iknow'][504]);
$object_ik_cartridge = get_object_ik_cartridge();
get_url_params();
$object_tab_level = get_tab_level();
$object_ik_valmod = get_object_ik_valmod();
/**==================================================================
	 * HTML declare page interpretation directive
	 ====================================================================*/
require '../../../../../../includes/common/html_doctype.php';
/*===================================================================*/
?>
<html>
	<head>
		<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link rel="stylesheet" href="../css/iknow_tiny.css" type="text/css">
		<link rel="stylesheet" href="../../../../../../css/ifiche/tiny.css" type="text/css">
		<link rel="stylesheet" href="../../../../../../css/common/iknow/iknow_onglet.css" type="text/css">
		<link rel="stylesheet" href="../../../../../../css/ifiche/common_fiche.css" type="text/css"/>
		<style type="text/css">
		.onglets
		{
Exemplo n.º 13
0
 public function listar($id_personagem)
 {
     $query = $this->query() . "\n            WHERE id_personagem = '" . do_escape($id_personagem) . "'\n            AND cod_situacao = '" . do_escape(QUEST_ATIVA) . "'\n        ";
     $quests = array();
     $result = get_result_db($query);
     while ($quest = get_object($result)) {
         if (array_key_exists($quest->id_tipo, $GLOBALS['_quest'])) {
             $this->carregar($quest);
             $quests[] = $quest;
         }
     }
     free_result($result);
     return $quests;
 }
Exemplo n.º 14
0
//$IMAGES_DIRECTORY    = "e107_images/";
//$MEDIA_DIRECTORY     = "e107_media/";
//$THEMES_DIRECTORY    = "e107_themes/";
//$PLUGINS_DIRECTORY   = "e107_plugins/";
//$HANDLERS_DIRECTORY  = "e107_handlers/";
//$LANGUAGES_DIRECTORY = "e107_languages/";
//$HELP_DIRECTORY      = "e107_docs/help/";
//$CACHE_DIRECTORY 	 = "e107_system/cache/";
//$DOWNLOADS_DIRECTORY = "e107_media/files/";
//$UPLOADS_DIRECTORY   = "e107_media/temp/";
//$LOGS_DIRECTORY		 = "e107_files/logs";
//$CORE_DIRECTORY		 = "e107_core/";
//$SYSTEM_DIRECTORY	 = "e107_system/";
/* End configurable variables */
if (isset($_GET['object'])) {
    get_object($_GET['object']);
    die;
}
define("e107_INIT", TRUE);
/*define("e_UC_PUBLIC", 0);
define("e_UC_MAINADMIN", 250);
define("e_UC_READONLY", 251);
define("e_UC_GUEST", 252);
define("e_UC_MEMBER", 253);
define("e_UC_ADMIN", 254);
define("e_UC_NOBODY", 255);*/
define("E107_INSTALL", TRUE);
error_reporting(E_ALL);
function e107_ini_set($var, $value)
{
    if (function_exists('ini_set')) {
Exemplo n.º 15
0
 public function gerarXML()
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->startDocument('1.0', 'UTF-8');
     $xml->startElement("urlset");
     $xml->writeAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
     $url = "http://{$_SERVER['HTTP_HOST']}";
     $xml->startElement("url");
     $xml->writeElement('loc', 'http://bibliaemdebate.com.br');
     //$xml->writeElement('lastmod', date('Y-m-d') );
     $xml->writeElement('changefreq', 'daily');
     $xml->writeElement('priority', '0.5');
     $xml->endElement();
     //url
     $query = "\n            SELECT DISTINCT\n                livros.liv_tes_id AS 'id_testamento',\n                versiculos.ver_liv_id AS 'id_livro',\n                versiculos.ver_capitulo AS 'id_capitulo'\n            FROM versiculos\n            INNER JOIN livros ON livros.liv_id = versiculos.ver_liv_id\n            AND versiculos.ver_vrs_id = 3\n            ORDER BY\n                livros.liv_tes_id,\n                versiculos.ver_liv_id,\n                versiculos.ver_capitulo\n        ";
     $result = get_result_db($query);
     while ($versiculo = get_object($result)) {
         $url = 'http://bibliaemdebate.com.br/nvi/';
         if ($versiculo->id_testamento == NOVO_TESTAMENTO) {
             $url .= 'nt';
         } elseif ($versiculo->id_testamento == ANTIGO_TESTAMENTO) {
             $url .= 'at';
         }
         $url .= "/{$versiculo->id_livro}/{$versiculo->id_capitulo}";
         $xml->startElement("url");
         $xml->writeElement('loc', $url);
         //$xml->writeElement('lastmod', substr($imovel->ultima_alteracao, 0, 10) );
         $xml->writeElement('changefreq', 'yearly');
         $xml->writeElement('priority', '1.0');
         $xml->endElement();
         //url
     }
     free_result($result);
     $xml->endElement();
     //urlset
     $xml->endDocument();
     //echo $xml->outputMemory(TRUE);
     return $xml;
 }
Exemplo n.º 16
0
 public function find($param = 'all')
 {
     $this->is_edited = false;
     if (is_string($param)) {
         $param = strtolower($param);
     }
     $limit = -1;
     $argsnum = func_num_args();
     $sqlstr = "select * from " . $this->_tablename . " where 1=1 ";
     if (intval($param) > 0) {
         $sqlstr .= " and id=" . $param;
         $limit = 1;
     }
     if ($param == 'first' || is_int($param)) {
         $limit = 1;
     }
     if ($argsnum >= 2) {
         $arg = func_get_arg(1);
         if (!is_array($arg)) {
             return;
         }
         if (!empty($arg["conditions"])) {
             $sqlstr .= " and " . $arg["conditions"];
         }
         $limit = intval($arg["limit"]) > 0 ? $arg["limit"] : $limit;
         if (!empty($arg["order"])) {
             $sqlstr .= " order by " . $arg["order"];
         }
     }
     if ($limit > 0) {
         $sqlstr .= " limit " . $limit;
     }
     $db = get_object('db');
     if (!$db->query($sqlstr)) {
         return null;
     }
     if ($limit == 1) {
         if ($db->record_count <= 0) {
             return null;
         }
         $result = clone $this;
         foreach ($this->fields as $k => $v) {
             $result->fields[$k] = $db->field_by_name($k);
             $this->fields[$k] = $db->field_by_name($k);
         }
         return $result;
     } else {
         $result = array();
         if ($db->record_count <= 0) {
             return $result;
         }
         do {
             $tmp = clone $this;
             foreach ($this->fields as $k => $v) {
                 $tmp->fields[$k] = $db->field_by_name($k);
             }
             $result[] = $tmp;
         } while ($db->move_next());
         return $result;
     }
 }
Exemplo n.º 17
0
function send_message()
{
    logit("POST", $_POST);
    // set_error_handler("error_handler");
    try {
        $message = params('message');
        $n_message = $message;
        $id = params('id');
        logit('looking for object', $id);
        $object = get_object($id);
        if (is_null($object)) {
            logit('object not found', params('id'));
            halt(NOT_FOUND, array("exception" => "ObjectNotFound", "error" => 'Object not found'));
            // return "object:" . params('id') . ": was not found";
        } else {
            $args = $_POST['args'];
            logit('message :' . $message . ' args <' . $args . '>');
            if (is_null($args) || $args == '[]') {
                logit('args are empty');
                if (!property_exists($object, $message)) {
                    throw new NoMethodError("Property {$message} does not exist");
                }
                $result = $object->{$message};
                logit("\$object->{$message} returning ", $result);
            } else {
                $orig_args = $args;
                logit('decoding args <' . $args . '>');
                $args = json_decode($args, true);
                logit('args are :', $args);
                if (preg_match('/\\=$/', $message) == 1) {
                    $n_message = substr($message, 0, strlen($message) - 1);
                    logit("\$object->{$n_message} = ", $args[0]);
                    if (!property_exists($object, $n_message)) {
                        throw new NoMethodError("property {$n_message} (original message:{$message}) does not exist");
                    }
                    $object->{$n_message} = $args[0];
                    $result = array();
                } else {
                    logit("\$obect->{$message}()");
                    logit('class of object', get_class($object));
                    logit('object', object_properties_to_hash($object));
                    if (!method_exists($object, $message)) {
                        throw new NoMethodError("method {$message} does not exist");
                    }
                    if (is_array($args)) {
                        // if (is_numeric($args[0])) {
                        $args = convert_objs($args);
                        logit("args after conversion", $args);
                        $argstr = join($args, ",");
                        logit("argstr after join", $argstr);
                        // }
                        // else {
                        //   $args = json_decode($orig_args, true);
                        //   $argstr = var_export($args, true);
                        // }
                    } else {
                        $argstr = $args;
                    }
                    logit("calling " . "return \$object->{$message}({$argstr});");
                    $result = eval("return \$object->{$message}({$argstr});");
                    logit("returning ", $result);
                }
            }
            store_object_with_id($object, $id);
            return json_encode(array($result));
        }
    } catch (Exception $e) {
        logit('Exception ' . $e->getMessage());
        halt(422, array("exception" => get_class($e), "error" => $e->getMessage()));
        // return json_encode(array('error' => $e->getMessage()));
    }
}
Exemplo n.º 18
0
     $object_type = 'user';
     $object_id = userid();
 }
 try {
     if (!userid()) {
         cb_error(lang('You are not logged in'));
     }
     $object = get_object($object_type, $object_id);
     if (!$object) {
         cb_error(lang('Invalid object request'));
     }
     $content_type = mysql_clean(post('content_type'));
     $content_id = mysql_clean(post('content_id'));
     //$content = post('content');
     if ($content_id) {
         $content = get_object($content_type, $content_id);
         if (!$content) {
             cb_error(lang('Invalid content request'));
         }
     }
     $post = mysql_clean(post('post'));
     if (!$content && !$post) {
         cb_error(lang('Please enter something for message'));
     }
     $action = mysql_clean(post('action'));
     if (!$action) {
         $action = 'added_status';
     }
     //Lets add the feed....
     $feed_array = array('userid' => userid(), 'user' => $userquery->udetails, 'content_id' => $content_id, 'content' => $cbfeeds->get_content($content_type, $content_id, $content), 'content_type' => $content_type, 'object_id' => $object_id, 'object' => $object, 'object_type' => $object_type, 'action' => $action, 'message' => $post);
     $fid = $cbfeeds->add_feed($feed_array);
Exemplo n.º 19
0
    //set_bucket_cors($oss_sdk_service);
    //get_bucket_cors($oss_sdk_service);
    //delete_bucket_cors($oss_sdk_service);
    //options_object($oss_sdk_service);
    /**
     * Object相关操作
     */
    //	list_object($oss_sdk_service);
    //create_directory($oss_sdk_service);
    //upload_by_content($oss_sdk_service);
    upload_by_file($oss_sdk_service);
    //copy_object($oss_sdk_service);
    //get_object_meta($oss_sdk_service);
    //delete_object($oss_sdk_service);
    //delete_objects($oss_sdk_service);
    get_object($oss_sdk_service);
    //is_object_exist($oss_sdk_service);
    //upload_by_multi_part($oss_sdk_service);
    //upload_by_dir($oss_sdk_service);
    //batch_upload_file($oss_sdk_service);
    /**
     * 外链url相关
     */
    //get_sign_url($oss_sdk_service);
} catch (Exception $ex) {
    die($ex->getMessage());
}
/**
 * 函数定义
 */
/*%**************************************************************************************************************%*/