Пример #1
1
function Main()
{
    global $TPLV, $bottom, $urls, $db, $migalha;
    $TPLV = new TemplatePower(TEMPLATE_PATH . "modulos/categoria.tpl");
    $TPLV->assignGlobal("uploadPath", UPLOAD_PATH);
    $TPLV->assignGlobal("uploadPath", UPLOAD_PATH_SITE);
    $TPLV->assignGlobal("imagePath", IMAGE_PATH);
    $TPLV->assignGlobal("swfPath", SWF_PATH);
    $TPLV->assignGlobal("localPath", LOCAL_PATH);
    $TPLV->assignGlobal("localPath", LOCAL_PATH_SITE);
    $TPLV->assignGlobal('navBottom', $bottom);
    $TPLV->assignGlobal($urls->var);
    $TPLV->prepare();
    $in = $_GET['in'];
    switch ($in) {
        default:
        case 'lista':
            lista();
            break;
        case 'novo':
            novo();
            break;
        case 'editar':
            editar();
            break;
        case 'salvar':
            salvar();
            break;
        case 'deletar':
            deletar();
            break;
    }
}
Пример #2
0
function Main()
{
    global $TPLV, $bottom, $db, $migalha, $usuario;
    $TPLV = new TemplatePower(TEMPLATE_PATH . "login.tpl");
    $TPLV->assignGlobal("uploadPath", UPLOAD_PATH);
    $TPLV->assignGlobal("imagePath", IMAGE_PATH);
    $TPLV->assignGlobal("swfPath", SWF_PATH);
    $TPLV->assignGlobal("localPath", LOCAL_PATH);
    $TPLV->assignGlobal('navBottom', $bottom);
    $TPLV->prepare();
    $in = $_GET['in'];
    switch ($in) {
        default:
        case 'restrito':
            if ($usuario->isLogado()) {
                inicio();
            } else {
                restrito();
            }
            break;
        case 'inicio':
            inicio();
            break;
        case 'logout':
            logout();
            break;
    }
}
Пример #3
0
function Main()
{
    global $TPLV, $urls, $usuario, $imovel;
    $TPLV = new TemplatePower(TEMPLATE_PATH . "login.tpl");
    $TPLV->assignGlobal("uploadPath", UPLOAD_PATH);
    $TPLV->assignGlobal("imagePath", IMAGE_PATH);
    $TPLV->assignGlobal("swfPath", SWF_PATH);
    $TPLV->assignGlobal("localPath", LOCAL_PATH);
    $TPLV->assignGlobal('navBottom', $bottom);
    $TPLV->assignGlobal($urls->var);
    $TPLV->prepare();
    $in = $_GET['in'];
    switch ($in) {
        //FILTROS DE BUSCAS
        default:
        case 'deletaUsuario':
            deletaUsuario();
            break;
        case 'deletaMidia':
            deletaMidia();
            break;
            //LOGIN E RECUPERA SENHA
        //LOGIN E RECUPERA SENHA
        case 'getLogin':
            getLogin();
            break;
        case 'login':
            login();
            break;
        case 'getSenha':
            getSenha();
            break;
        case 'recuperaSenha':
            recuperaSenha();
            break;
        case 'isLogado':
            if ($usuario->isLogado()) {
                echo 'logado';
            } else {
                echo 'erro';
            }
            break;
            //CADASTRO
        //CADASTRO
        case 'validaEmailCadastro':
            validaEmailCadastro();
            break;
            //LEADS DETALHES
        //LEADS DETALHES
        case 'getCadastro':
            getCadastro();
            break;
        case 'salvarCadastro':
            salvarCadastro();
            break;
        case 'verificaCPF':
            verificaCPF();
            break;
    }
}
Пример #4
0
    /**
     * DEPRECATED createPropelClasses()
     *
     * Don't use this method, it was left only for backward compatibility
     * for some external plugins that still is using it
     */
    public function createPropelClasses($sTableName, $sClassName, $aFields, $sAddTabUid, $connection = 'workflow')
    {
        try {
            /* $aUID = array('FLD_NAME'           => 'PM_UNIQUE_ID',
              'FLD_TYPE'           => 'INT',
              'FLD_KEY'            => 'on',
              'FLD_SIZE'           => '11',
              'FLD_NULL'           => '',
              'FLD_AUTO_INCREMENT' => 'on');
              array_unshift($aFields, $aUID); */
            $aTypes = array(
                'VARCHAR' => 'string',
                'TEXT'    => 'string',
                'DATE'    => 'int',
                'INT'     => 'int',
                'FLOAT'   => 'double'
            );
            $aCreoleTypes = array(
                'VARCHAR' => 'VARCHAR',
                'TEXT'    => 'LONGVARCHAR',
                'DATE'    => 'TIMESTAMP',
                'INT'     => 'INTEGER',
                'FLOAT'   => 'DOUBLE'
            );
            if ($sClassName == '') {
                $sClassName = $this->getPHPName($sTableName);
            }

            $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP;
            if (!file_exists($sPath)) {
                G::mk_dir($sPath);
            }
            if (!file_exists($sPath . 'map')) {
                G::mk_dir($sPath . 'map');
            }
            if (!file_exists($sPath . 'om')) {
                G::mk_dir($sPath . 'om');
            }
            $aData = array();
            $aData['pathClasses'] = substr(PATH_DB, 0, -1);
            $aData['tableName'] = $sTableName;
            $aData['className'] = $sClassName;
            $aData['connection'] = $connection;
            $aData['GUID'] = $sAddTabUid;

            $aData['firstColumn'] = isset($aFields[0])
                                    ? strtoupper($aFields[0]['FLD_NAME'])
                                    : ($aFields[1]['FLD_NAME']);
            $aData['totalColumns'] = count($aFields);
            $aData['useIdGenerator'] = 'false';
            $oTP1 = new TemplatePower(PATH_TPL . 'additionalTables' . PATH_SEP . 'Table.tpl');
            $oTP1->prepare();
            $oTP1->assignGlobal($aData);
            file_put_contents($sPath . $sClassName . '.php', $oTP1->getOutputContent());
            $oTP2 = new TemplatePower(PATH_TPL . 'additionalTables' . PATH_SEP . 'TablePeer.tpl');
            $oTP2->prepare();
            $oTP2->assignGlobal($aData);
            file_put_contents($sPath . $sClassName . 'Peer.php', $oTP2->getOutputContent());
            $aColumns = array();
            $aPKs = array();
            $aNotPKs = array();
            $i = 0;
            foreach ($aFields as $iKey => $aField) {
                $aField['FLD_NAME'] = strtoupper($aField['FLD_NAME']);
                if ($aField['FLD_TYPE'] == 'DATE') {
                    $aField['FLD_NULL'] = '';
                }
                $aColumn = array(
                    'name' => $aField['FLD_NAME'],
                    'phpName' => $this->getPHPName($aField['FLD_NAME']),
                    'type' => $aTypes[$aField['FLD_TYPE']],
                    'creoleType' => $aCreoleTypes[$aField['FLD_TYPE']],
                    'notNull' => ($aField['FLD_NULL'] == 'on' ? 'true' : 'false'),
                    'size' => (($aField['FLD_TYPE'] == 'VARCHAR')
                              || ($aField['FLD_TYPE'] == 'INT')
                              || ($aField['FLD_TYPE'] == 'FLOAT') ? $aField['FLD_SIZE'] : 'null'),
                    'var' => strtolower($aField['FLD_NAME']),
                    'attribute' => (($aField['FLD_TYPE'] == 'VARCHAR')
                                   || ($aField['FLD_TYPE'] == 'TEXT')
                                   || ($aField['FLD_TYPE'] == 'DATE')
                                   ? '$' . strtolower($aField['FLD_NAME']) . " = ''"
                                   : '$' . strtolower($aField['FLD_NAME']) . ' = 0'),
                    'index' => $i,
                );
                if ($aField['FLD_TYPE'] == 'DATE') {
                    $aColumn['getFunction'] = '/**
   * Get the [optionally formatted] [' . $aColumn['var'] . '] column value.
   *
   * @param      string $format The date/time format string (either date()-style or strftime()-style).
   *              If format is NULL, then the integer unix timestamp will be returned.
   * @return     mixed Formatted date/time value as string or integer unix timestamp (if format is NULL).
   * @throws     PropelException - if unable to convert the date/time to timestamp.
   */
  public function get' . $aColumn['phpName'] . '($format = "Y-m-d")
  {

    if ($this->' . $aColumn['var'] . ' === null || $this->' . $aColumn['var'] . ' === "") {
      return null;
    } elseif (!is_int($this->' . $aColumn['var'] . ')) {
      // a non-timestamp value was set externally, so we convert it
      if (($this->' . $aColumn['var'] . ' == "0000-00-00 00:00:00")
           || ($this->' . $aColumn['var'] . ' == "0000-00-00") || !$this->' . $aColumn['var'] . ') {
        $ts = "0";
      }
      else {
        $ts = strtotime($this->' . $aColumn['var'] . ');
      }
      if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
        throw new PropelException("Unable to parse value of [' . $aColumn['var'] . '] as date/time value: "
                                 . var_export($this->' . $aColumn['var'] . ', true));
      }
    } else {
      $ts = $this->' . $aColumn['var'] . ';
    }
    if ($format === null) {
      return $ts;
    } elseif (strpos($format, "%") !== false) {
      return strftime($format, $ts);
    } else {
      return date($format, $ts);
    }
  }';
                } else {
                    $aColumn['getFunction'] = '/**
   * Get the [' . $aColumn['var'] . '] column value.
   *
   * @return     string
   */
  public function get' . $aColumn['phpName'] . '()
  {

    return $this->' . $aColumn['var'] . ';
  }';
                }
                switch ($aField['FLD_TYPE']) {
                    case 'VARCHAR':
                    case 'TEXT':
                        $aColumn['setFunction'] = '// Since the native PHP type for this column is string,
    // we will cast the input to a string (if it is not).
    if ($v !== null && !is_string($v)) {
      $v = (string) $v;
    }

    if ($this->' . $aColumn['var'] . ' !== $v) {
      $this->' . $aColumn['var'] . ' = $v;
      $this->modifiedColumns[] = ' . $aData['className'] . 'Peer::' . $aColumn['name'] . ';
    }';
                        break;
                    case 'DATE':
                        $aColumn['setFunction'] = 'if ($v !== null && !is_int($v)) {
      // if($v == \'\')
      //   $ts = null;
     // else
       $ts = strtotime($v);
     if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
       //throw new PropelException("Unable to parse date/time value for [' . $aColumn['var'] . '] from input: "
       //                          . var_export($v, true));
     }
   } else {
     $ts = $v;
   }
   if ($this->' . $aColumn['var'] . ' !== $ts) {
     $this->' . $aColumn['var'] . ' = $ts;
     $this->modifiedColumns[] = ' . $aData['className'] . 'Peer::' . $aColumn['name'] . ';
   }';
                        break;
                    case 'INT':
                        $aColumn['setFunction'] = '// Since the native PHP type for this column is integer,
   // we will cast the input value to an int (if it is not).
   if ($v !== null && !is_int($v) && is_numeric($v)) {
     $v = (int) $v;
   }
   if ($this->' . $aColumn['var'] . ' !== $v || $v === 1) {
     $this->' . $aColumn['var'] . ' = $v;
     $this->modifiedColumns[] = ' . $aData['className'] . 'Peer::' . $aColumn['name'] . ';
   }';
                        break;
                    case 'FLOAT':
                        $aColumn['setFunction'] = 'if ($this->' . $aColumn['var'] . ' !== $v || $v === 0) {
     $this->' . $aColumn['var'] . ' = $v;
     $this->modifiedColumns[] = ' . $aData['className'] . 'Peer::' . $aColumn['name'] . ';
   }';
                        break;
                }
                $aColumns[] = $aColumn;
                if ($aField['FLD_KEY'] == 1 || $aField['FLD_KEY'] === 'on') {
                    $aPKs[] = $aColumn;
                } else {
                    $aNotPKs[] = $aColumn;
                }
                if ($aField['FLD_AUTO_INCREMENT'] == 1 || $aField['FLD_AUTO_INCREMENT'] === 'on') {
                    $aData['useIdGenerator'] = 'true';
                }
                $i++;
            }
            $oTP3 = new TemplatePower(PATH_TPL . 'additionalTables' . PATH_SEP . 'map'
                                    . PATH_SEP . 'TableMapBuilder.tpl');
            $oTP3->prepare();
            $oTP3->assignGlobal($aData);
            foreach ($aPKs as $iIndex => $aColumn) {
                $oTP3->newBlock('primaryKeys');
                $aKeys = array_keys($aColumn);
                foreach ($aKeys as $sKey) {
                    $oTP3->assign($sKey, $aColumn[$sKey]);
                }
            }
            $oTP3->gotoBlock('_ROOT');
            foreach ($aNotPKs as $iIndex => $aColumn) {
                $oTP3->newBlock('columnsWhitoutKeys');
                $aKeys = array_keys($aColumn);
                foreach ($aKeys as $sKey) {
                    $oTP3->assign($sKey, $aColumn[$sKey]);
                }
            }
            file_put_contents($sPath . PATH_SEP . 'map' . PATH_SEP . $sClassName
                           . 'MapBuilder.php', $oTP3->getOutputContent());
            $oTP4 = new TemplatePower(PATH_TPL . 'additionalTables' . PATH_SEP . 'om' . PATH_SEP . 'BaseTable.tpl');
            $oTP4->prepare();
            switch (count($aPKs)) {
                case 0:
                    $aData['getPrimaryKeyFunction'] = 'return null;';
                    $aData['setPrimaryKeyFunction'] = '';
                    break;
                case 1:
                    $aData['getPrimaryKeyFunction'] = 'return $this->get' . $aPKs[0]['phpName'] . '();';
                    $aData['setPrimaryKeyFunction'] = '$this->set' . $aPKs[0]['phpName'] . '($key);';
                    break;
                default:
                    $aData['getPrimaryKeyFunction'] = '$pks = array();' . "\n";
                    $aData['setPrimaryKeyFunction'] = '';
                    foreach ($aPKs as $iIndex => $aColumn) {
                        $aData['getPrimaryKeyFunction'] .= '$pks[' . $iIndex . '] = $this->get'
                                                         . $aColumn['phpName'] . '();' . "\n";
                        $aData['setPrimaryKeyFunction'] .= '$this->set' . $aColumn['phpName']
                                                         . '($keys[' . $iIndex . ']);' . "\n";
                    }
                    $aData['getPrimaryKeyFunction'] .= 'return $pks;' . "\n";
                    break;
            }
            $oTP4->assignGlobal($aData);
            foreach ($aColumns as $iIndex => $aColumn) {
                $oTP4->newBlock('allColumns1');
                $aKeys = array_keys($aColumn);
                foreach ($aKeys as $sKey) {
                    $oTP4->assign($sKey, $aColumn[$sKey]);
                }
                $oTP4->newBlock('allColumns2');
                $aKeys = array_keys($aColumn);
                foreach ($aKeys as $sKey) {
                    $oTP4->assign($sKey, $aColumn[$sKey]);
                }
                $oTP4->newBlock('allColumns3');
                $aKeys = array_keys($aColumn);
                foreach ($aKeys as $sKey) {
                    $oTP4->assign($sKey, $aColumn[$sKey]);
                }
                $oTP4->newBlock('allColumns4');
                $aKeys = array_keys($aColumn);
                foreach ($aKeys as $sKey) {
                    $oTP4->assign($sKey, $aColumn[$sKey]);
                }
                $oTP4->newBlock('allColumns5');
                $aKeys = array_keys($aColumn);
                foreach ($aKeys as $sKey) {
                    $oTP4->assign($sKey, $aColumn[$sKey]);
                }
                $oTP4->newBlock('allColumns6');
                $aKeys = array_keys($aColumn);
                foreach ($aKeys as $sKey) {
                    $oTP4->assign($sKey, $aColumn[$sKey]);
                }
                $oTP4->newBlock('allColumns7');
                $aKeys = array_keys($aColumn);
                foreach ($aKeys as $sKey) {
                    $oTP4->assign($sKey, $aColumn[$sKey]);
                }
                $oTP4->newBlock('allColumns8');
                $aKeys = array_keys($aColumn);
                foreach ($aKeys as $sKey) {
                    $oTP4->assign($sKey, $aColumn[$sKey]);
                }
                $oTP4->newBlock('allColumns9');
                $aKeys = array_keys($aColumn);
                foreach ($aKeys as $sKey) {
                    $oTP4->assign($sKey, $aColumn[$sKey]);
                }
            }
            $oTP4->gotoBlock('_ROOT');
            foreach ($aPKs as $iIndex => $aColumn) {
                $oTP4->newBlock('primaryKeys1');
                $aKeys = array_keys($aColumn);
                foreach ($aKeys as $sKey) {
                    $oTP4->assign($sKey, $aColumn[$sKey]);
                }
            }
            $oTP4->gotoBlock('_ROOT');
            foreach ($aPKs as $iIndex => $aColumn) {
                $oTP4->newBlock('primaryKeys2');
                $aKeys = array_keys($aColumn);
                foreach ($aKeys as $sKey) {
                    $oTP4->assign($sKey, $aColumn[$sKey]);
                }
            }
            $oTP4->gotoBlock('_ROOT');
            foreach ($aNotPKs as $iIndex => $aColumn) {
                $oTP4->newBlock('columnsWhitoutKeys');
                $aKeys = array_keys($aColumn);
                foreach ($aKeys as $sKey) {
                    $oTP4->assign($sKey, $aColumn[$sKey]);
                }
            }
            file_put_contents($sPath . PATH_SEP . 'om' . PATH_SEP . 'Base'
                            . $sClassName . '.php', $oTP4->getOutputContent());
            $oTP5 = new TemplatePower(PATH_TPL . 'additionalTables' . PATH_SEP . 'om' . PATH_SEP . 'BaseTablePeer.tpl');
            $oTP5->prepare();
            $sKeys = '';
            foreach ($aPKs as $iIndex => $aColumn) {
                $sKeys .= '$' . $aColumn['var'] . ', ';
            }
            $sKeys = substr($sKeys, 0, -2);
            //$sKeys = '$pm_unique_id';
            if ($sKeys != '') {
                $aData['sKeys'] = $sKeys;
            } else {
                $aData['sKeys'] = '$DUMMY';
            }
            $oTP5->assignGlobal($aData);
            foreach ($aColumns as $iIndex => $aColumn) {
                $oTP5->newBlock('allColumns1');
                $aKeys = array_keys($aColumn);
                foreach ($aKeys as $sKey) {
                    $oTP5->assign($sKey, $aColumn[$sKey]);
                }
                $oTP5->newBlock('allColumns2');
                $aKeys = array_keys($aColumn);
                foreach ($aKeys as $sKey) {
                    $oTP5->assign($sKey, $aColumn[$sKey]);
                }
                $oTP5->newBlock('allColumns3');
                $aKeys = array_keys($aColumn);
                foreach ($aKeys as $sKey) {
                    $oTP5->assign($sKey, $aColumn[$sKey]);
                }
                $oTP5->newBlock('allColumns4');
                $aKeys = array_keys($aColumn);
                foreach ($aKeys as $sKey) {
                    $oTP5->assign($sKey, $aColumn[$sKey]);
                }
                $oTP5->newBlock('allColumns5');
                $aKeys = array_keys($aColumn);
                foreach ($aKeys as $sKey) {
                    $oTP5->assign($sKey, $aColumn[$sKey]);
                }
                $oTP5->newBlock('allColumns6');
                $aKeys = array_keys($aColumn);
                foreach ($aKeys as $sKey) {
                    $oTP5->assign($sKey, $aColumn[$sKey]);
                }
                $oTP5->newBlock('allColumns7');
                $aKeys = array_keys($aColumn);
                foreach ($aKeys as $sKey) {
                    $oTP5->assign($sKey, $aColumn[$sKey]);
                }
                $oTP5->newBlock('allColumns8');
                $aKeys = array_keys($aColumn);
                foreach ($aKeys as $sKey) {
                    $oTP5->assign($sKey, $aColumn[$sKey]);
                }
                $oTP5->newBlock('allColumns9');
                $aKeys = array_keys($aColumn);
                foreach ($aKeys as $sKey) {
                    $oTP5->assign($sKey, $aColumn[$sKey]);
                }
                $oTP5->newBlock('allColumns10');
                $aKeys = array_keys($aColumn);
                foreach ($aKeys as $sKey) {
                    $oTP5->assign($sKey, $aColumn[$sKey]);
                }
            }
            $oTP5->gotoBlock('_ROOT');
            foreach ($aPKs as $iIndex => $aColumn) {
                $oTP5->newBlock('primaryKeys1');
                $aKeys = array_keys($aColumn);
                foreach ($aKeys as $sKey) {
                    $oTP5->assign($sKey, $aColumn[$sKey]);
                }
            }
            foreach ($aPKs as $iIndex => $aColumn) {
                $oTP5->newBlock('primaryKeys2');
                $aKeys = array_keys($aColumn);
                foreach ($aKeys as $sKey) {
                    $oTP5->assign($sKey, $aColumn[$sKey]);
                }
            }
            file_put_contents($sPath . PATH_SEP . 'om' . PATH_SEP . 'Base'
                            . $sClassName . 'Peer.php', $oTP5->getOutputContent());
        } catch (Exception $oError) {
            throw($oError);
        }
    }
Пример #5
0
                    $tp->assign($k, $v);
                }
                if ($CurMess['message_type'] == 1 or $CurMess['message_type'] == 2) {
                    unset($replace);
                    $tp->newBlock("answer");
                    $replace[id] = $CurMess['message_sender'];
                    $replace[subject] = $lang['mess_answer_prefix'] . htmlspecialchars($CurMess['message_subject']);
                    foreach ($replace as $k => $v) {
                        $tp->assign($k, $v);
                    }
                }
            }
            break;
    }
    $tp->gotoBlock("_ROOT");
    $tp->assignGlobal("PHPSELF", $_SERVER['PHP_SELF']);
    foreach ($lang as $name => $trans) {
        $tp->assignGlobal("lang_" . $name, $trans);
    }
    $page .= $tp->getOutputContent();
    display($page, $lang['mess_pagetitle']);
} else {
    $OwnerID = $_GET['id'];
    $MessCategory = $_GET['messcat'];
    $MessPageMode = $_GET["mode"];
    $DeleteWhat = $_POST['deletemessages'];
    if (isset($DeleteWhat)) {
        $MessPageMode = "delete";
    }
    $UsrMess = doquery("SELECT * FROM {{table}} WHERE `message_owner` = '" . $user['id'] . "' ORDER BY `message_time` DESC;", 'messages');
    $UnRead = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $user['id'] . "';", 'users', true);
Пример #6
0
            // ACTIONS
            $actions = _TooltipActions($planetsrow[$i], $g, $s, $i, 0);
            $tp->assign("actions", $actions);
        } else {
            // ADD BLANK TDS ?
        }
    }
    $replace[fleet_count] = $MaxFleetCount;
    $replace[fleet_max] = $FleetMax;
    $replace[Recyclers] = pretty_number($CurrentRC);
    $replace[SpyProbes] = pretty_number($CurrentSP);
    $replace[CurrentMIP] = pretty_number($CurrentMIP);
    $replace[this_galaxy] = $planetrow['galaxy'];
    $replace[this_system] = $planetrow['system'];
    $replace[this_planet] = $planetrow['planet'];
    $replace[this_planet_type] = $planetrow['planet_type'];
    $replace[PHP_SELF] = $_SERVER['PHP_SELF'];
    $tp->gotoBlock("_ROOT");
    if (is_array($replace)) {
        foreach ($replace as $k => $v) {
            $tp->assign($k, $v);
        }
    }
    // GLOBAL VARIABLES
    $lang[dpath] = $dpath;
    foreach ($lang as $name => $trans) {
        $tp->assignGlobal($name, $trans);
    }
    $galaxy = $tp->getOutputContent();
    display($galaxy, 'Galaxy', false);
}
Пример #7
0
<?php

require_once 'config.inc.php';
$tpl_main = new TemplatePower('template/master.html');
$tpl_main->prepare();
// see if the login form was submitted
if (isset($_POST['login'])) {
    $user = stripslashes($_POST['username']);
    $pass = stripslashes($_POST['password']);
    $goto = $_POST['redirect'];
    if ($_AUTH->login($user, $pass)) {
        include_once $goto;
        die;
    } else {
        $tpl = new TemplatePower('template/error.html');
        $tpl->assignGlobal('error_message', 'Invalid username / password.' . $user);
    }
    // display the default login form
} else {
    $tpl = new TemplatePower('template/login.html');
    $tpl->assignGlobal('redirect', $_GET['redirect']);
}
$tpl->prepare();
$tpl->showUnAssigned(false);
$tpl_main->assign('content', $tpl->getOutputContent());
$tpl_main->showUnAssigned(false);
$tpl_main->printToScreen();
Пример #8
0
    }
    // pull the template together
    $tpl->prepare();
    // display the selected course
    if (isset($course)) {
        $c = get_user_courses($_DB);
        $course = $c[0]['courseID'];
        set_course_template($_DB, $tpl, $course);
    }
    // add the remaining components to the template
    $tpl->assignGlobal('course_select_box', gen_course_select_box($_DB));
    $tpl->assignGlobal('username', $_SESSION['userName']);
}
// for all of the pages, put the content into the main template
$tpl->showUnAssigned(false);
$tpl_main->assignGlobal("content", $tpl->getOutputContent());
$tpl_main->showUnAssigned(false);
$tpl_main->printToScreen();
/**
 * Return a list of courses that the user is enrolled in
 *
 * @db the MySQL database connection
 *
 **/
function get_user_courses($db)
{
    $user = $_SESSION['userID'];
    $db->sql_query("SELECT * FROM courses WHERE courseID = ( SELECT course FROM studentstocourses WHERE student =  '{$user}' ) ");
    return $db->sql_fetchrowset();
}
/**
Пример #9
0
 /**
  * Formata a news padrão da linklar
  * @params string $titulo
  * @params string $texto
  * @returns html formatada.
  */
 public function formataEmail($titulo, $texto)
 {
     global $geral;
     $MAIL = new TemplatePower(TEMPLATE_PATH . "includes/mail.tpl");
     $MAIL->assignGlobal("uploadPath", UPLOAD_PATH);
     $MAIL->assignGlobal("imagePath", IMAGE_PATH);
     $MAIL->prepare();
     $MAIL->newBlock('mail');
     $MAIL->assign('titulo', $titulo);
     $MAIL->assign('texto', $texto);
     return $MAIL->getOutputContent();
 }
Пример #10
0
function create_file_from_tpl($tplName, $newFilename, $fields = NULL)
{
    global $pathHome;
    global $projectName;
    $httpdTpl = PATH_GULLIVER_HOME . 'bin' . PATH_SEP . 'tasks' . PATH_SEP . 'templates' . PATH_SEP . $tplName . '.tpl';
    if (substr($newFilename, 0, 1) == PATH_SEP) {
        $httpFilename = $newFilename;
    } else {
        $httpFilename = $pathHome . PATH_SEP . $newFilename;
    }
    $template = new TemplatePower($httpdTpl);
    $template->prepare();
    $template->assignGlobal('pathHome', $pathHome);
    $template->assignGlobal('projectName', $projectName);
    $template->assignGlobal('rbacProjectName', strtoupper($projectName));
    $template->assignGlobal('siglaProjectName', substr(strtoupper($projectName), 0, 3));
    $template->assignGlobal('propel.output.dir', '{propel.output.dir}');
    if (is_array($fields)) {
        foreach ($fields as $block => $data) {
            $template->gotoBlock("_ROOT");
            if (is_array($data)) {
                foreach ($data as $rowId => $row) {
                    $template->newBlock($block);
                    foreach ($row as $key => $val) {
                        if (is_array($val)) {
                            //              $template->newBlock( $key );
                            foreach ($val as $key2 => $val2) {
                                if (is_array($val2)) {
                                    $template->newBlock($key);
                                    foreach ($val2 as $key3 => $val3) {
                                        $template->assign($key3, $val3);
                                    }
                                }
                            }
                        } else {
                            $template->assign($key, $val);
                        }
                    }
                }
            } else {
                $template->assign($block, $data);
            }
        }
    }
    $content = $template->getOutputContent();
    $iSize = file_put_contents($httpFilename, $content);
    printf("saved %s bytes in file %s \n", pakeColor::colorize($iSize, 'INFO'), pakeColor::colorize($tplName, 'INFO'));
}
Пример #11
0
function ShowMessagesPage($CurrentUser)
{
    global $xgp_root, $phpEx, $game_config, $dpath, $lang, $messfields, $_POST, $_GET;
    includeLang('INGAME');
    if ($_POST) {
        switch ($_POST["action"]) {
            case "delete":
                if ($_POST["id"]) {
                    $MessId = intval($_POST["id"]);
                    doquery("DELETE FROM {{table}} WHERE `message_id` = '" . $MessId . "' AND message_owner = '" . $CurrentUser["id"] . "'", 'messages', '');
                }
                exit;
                break;
            case "deleteall":
                $MessCat = intval($_POST["messcat"]);
                if ($MessCat != "100") {
                    $sql = "`message_type` = " . $MessCat . " AND ";
                }
                doquery("DELETE FROM {{table}} WHERE {$sql} message_owner = " . $CurrentUser["id"], 'messages');
                exit;
                break;
        }
    }
    // ADD SMILIES ARRAY
    //makeSmiliesArray();
    include_once $xgp_root . 'includes/classes/class.TemplatePower.inc.' . $phpEx;
    $tp = new TemplatePower($xgp_root . TEMPLATE_DIR . "messages_new.tpl");
    $tp->prepare();
    $OwnerID = $_GET['id'];
    $MessCategory = isset($_GET['messcat']) ? $_GET['messcat'] : '100';
    $MessPageMode = isset($_GET['mode']) ? $_GET['mode'] : 'show';
    $UsrMess = doquery("SELECT * FROM {{table}} WHERE `message_owner` = '" . $CurrentUser['id'] . "' ORDER BY `message_time` DESC;", 'messages');
    $UnRead = $CurrentUser;
    $MessageType = array(100, 0, 1, 2, 3, 4, 5, 15, 99);
    $TitleColor = array(0 => '#FFFF00', 1 => '#FFFF00', 2 => '#FFFF00', 3 => '#FFFF00', 4 => '#FFFF00', 5 => '#FFFF00', 15 => '#FFFF00', 99 => '#FFFF00', 100 => '#FFFF00');
    $BackGndColor = array(0 => '#663366', 1 => '#663366', 2 => '#663366', 3 => '#663366', 4 => '#663366', 5 => '#663366', 15 => '#663366', 99 => '#663366', 100 => '#663366');
    foreach ($MessageType as $MessType) {
        $TotalMess[$MessType] = 0;
    }
    while ($CurMess = mysql_fetch_array($UsrMess)) {
        $MessType = $CurMess['message_type'];
        $TotalMess[$MessType] += 1;
        $TotalMess[100] += 1;
    }
    foreach ($MessageType as $k => $id) {
        $tp->newBlock("message_type");
        $replace[type] = $id;
        $replace[unread] = $WaitingMess[$id];
        $replace[total] = $TotalMess[$id];
        $replace[name] = $lang['mg_type'][$id];
        foreach ($replace as $k => $v) {
            $tp->assign($k, $v);
        }
    }
    switch ($MessPageMode) {
        case 'write':
            if ($_REQUEST['subject']) {
                $subject = $_REQUEST['subject'];
            }
            if (!is_numeric($OwnerID)) {
                header("location:game.php?page=messages");
            }
            $OwnerRecord = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $OwnerID . "';", 'users', true);
            if (!$OwnerRecord) {
                header("location:game.php?page=messages");
            }
            $OwnerHome = doquery("SELECT * FROM {{table}} WHERE `id_planet` = '" . $OwnerRecord["id_planet"] . "';", 'galaxy', true);
            if (!$OwnerHome) {
                header("location:game.php?page=messages");
            }
            if ($_POST) {
                $error = 0;
                $errorlist = "";
                if (!$_POST["subject"] & !$_POST["text"]) {
                    $errorlist .= $lang['mg_no_text_subject'];
                    $error++;
                } elseif (!$_POST["subject"]) {
                    $errorlist .= $lang['mg_no_subject'];
                    $error++;
                } elseif (!$_POST["text"]) {
                    $errorlist .= $lang['mg_no_text'];
                    $error++;
                }
                if ($error != 0) {
                    message($errorlist);
                } else {
                    $_POST['text'] = str_replace("'", '&#39;', $_POST['text']);
                    //                  $_POST['text'] = str_replace('rn', '<br />', $_POST['text']);
                    $Owner = $OwnerID;
                    $Sender = $CurrentUser['id'];
                    $From = $CurrentUser['username'] . " [" . $CurrentUser['galaxy'] . ":" . $CurrentUser['system'] . ":" . $CurrentUser['planet'] . "]";
                    $Subject = $_POST['subject'];
                    $Message = preg_replace("/([^\\s]{80}?)/", "\\1<br />", trim(nl2br(strip_tags($_POST['text'], '<br>'))));
                    SendSimpleMessage($Owner, $Sender, '', 1, $From, $Subject, $Message);
                    $subject = "";
                    $text = "";
                    message($lang['mg_msg_sended'], "game.php?page=messages", "2");
                }
            }
            $parse['id'] = $OwnerID;
            $parse['to'] = $OwnerRecord['username'] . " [" . $OwnerHome['galaxy'] . ":" . $OwnerHome['system'] . ":" . $OwnerHome['planet'] . "]";
            $parse['subject'] = !isset($subject) ? $lang['mg_sin_subject'] : $subject;
            $parse['text'] = $text;
            $tp->newBlock("new_message");
            $tp->assign("new_message", parsetemplate(gettemplate('messages_pm_form'), $parse));
            break;
        default:
        case 'show':
            if ($CurrentUser["new_message"] != 0) {
                doquery("UPDATE {{table}} SET `new_message` ='0' WHERE `id` = '" . $CurrentUser['id'] . "' ", "users", '');
            }
            if ($MessCategory == 100) {
                $UsrMess = doquery("SELECT SQL_CACHE * FROM {{table}} WHERE `message_owner` = " . $CurrentUser['id'] . " ORDER BY `message_time` DESC;", 'messages', '');
            } else {
                $UsrMess = doquery("SELECT SQL_CACHE * FROM {{table}} WHERE `message_owner` = " . $CurrentUser['id'] . " AND `message_type` = " . intval($MessCategory) . " ORDER BY `message_time` DESC;", 'messages', '');
            }
            while ($CurMess = @mysql_fetch_array($UsrMess)) {
                unset($replace);
                $tp->newBlock("message");
                $replace[id] = $CurMess['message_id'];
                $replace[mdate] = date("m-d H:i:s O", $CurMess['message_time']);
                $replace[from] = stripslashes($CurMess['message_from']);
                $replace[subject] = stripslashes($CurMess['message_subject']);
                //$replace[message] = makeMessageSmilies(nl2br( stripslashes( $CurMess['message_text'] ) ));
                $replace[message] = nl2br(stripslashes($CurMess['message_text']));
                foreach ($replace as $k => $v) {
                    $tp->assign($k, $v);
                }
                if ($CurMess['message_type'] == 1 or $CurMess['message_type'] == 2) {
                    unset($replace);
                    $tp->newBlock("answer");
                    $replace[id] = $CurMess['message_sender'];
                    $replace[subject] = $lang['mg_answer_prefix'] . htmlspecialchars($CurMess['message_subject']);
                    foreach ($replace as $k => $v) {
                        $tp->assign($k, $v);
                    }
                }
            }
            break;
    }
    $tp->gotoBlock("_ROOT");
    $tp->assignGlobal("PHPSELF", $_SERVER['PHP_SELF']);
    foreach ($lang as $name => $trans) {
        $tp->assignGlobal("lang_" . $name, $trans);
    }
    $page .= $tp->getOutputContent();
    display($page);
}
Пример #12
0
function Main()
{
    global $TPLV, $bottom, $urls, $db, $migalha;
    $TPLV = new TemplatePower(TEMPLATE_PATH . "modulos/produtos.tpl");
    $TPLV->assignGlobal("uploadPath", UPLOAD_PATH);
    $TPLV->assignGlobal("uploadPath", UPLOAD_PATH_SITE);
    $TPLV->assignGlobal("imagePath", IMAGE_PATH);
    $TPLV->assignGlobal("swfPath", SWF_PATH);
    $TPLV->assignGlobal("localPath", LOCAL_PATH);
    $TPLV->assignGlobal("localPath", LOCAL_PATH_SITE);
    $TPLV->assignGlobal('navBottom', $bottom);
    $TPLV->assignGlobal($urls->var);
    $TPLV->prepare();
    $in = $_GET['in'];
    switch ($in) {
        default:
            /**- LISTA DE CATEGORIAS -**/
        /**- LISTA DE CATEGORIAS -**/
        case 'lista':
            lista();
            break;
        case 'nova':
            nova();
            break;
        case 'edita':
            edita();
            break;
        case 'salva':
            salva();
            break;
        case 'apagaFoto':
            apagaFoto();
            break;
        case 'deleta':
            deleta();
            break;
            /**- LISTA DE PRODUTOS -**/
        /**- LISTA DE PRODUTOS -**/
        case 'listar':
            listar();
            break;
        case 'novo':
            novo();
            break;
        case 'editar':
            editar();
            break;
        case 'download':
            download();
            break;
        case 'download_salvar':
            download_salvar();
            break;
        case 'download_deletar':
            download_deletar();
            break;
        case 'salvar':
            salvar();
            break;
        case 'deletar':
            deletar();
            break;
        case 'deletarNutricional':
            deletarNutricional();
            break;
        case 'apagarFoto':
            apagarFoto();
            break;
    }
}