Beispiel #1
0
 public function execute($task)
 {
     if (JDEBUG) {
         dumpMessage("JoopoaUserController Execute: " . $task);
     }
     parent::execute($task);
 }
Beispiel #2
0
 public function sobre()
 {
     if (JDEBUG) {
         dumpMessage("JoopoaUserController Execute: " . $task);
     }
     JRequest::setVar('view', 'joopoauser');
     JRequest::setVar('layout', 'default');
     //JRequest::setVar('hidemainmenu', 1);
     parent::display();
 }
Beispiel #3
0
 protected function getLabel($flag = false)
 {
     $debug = true;
     $debug = false;
     // Here I handle dependant load of categories
     static $count = array();
     static $from_params = null;
     static $defaults = array();
     //~ static $runNumber = 0;
     //~ $runNumber++;
     if (isset($this->element['label'])) {
         $this->element['label'] = $this->_replaceNestedJtextConstants($this->element['label']);
     }
     if (isset($this->element['description'])) {
         $this->element['description'] = $this->_replaceNestedJtextConstants($this->element['description']);
     }
     if (!$flag || !isset($this->origname)) {
         $this->origname = (string) $this->fieldname;
     }
     if (!isset($defaults[$this->origname])) {
         $default = $this->getAttribute('default');
         //~ if (trim($default) != '') {
         //~ }
         $defaults[$this->origname] = $default;
     }
     $this->defaults = $defaults;
     //~ echo '<pre style="background:#efefef">'.PHP_EOL;
     //~ print_r($this->origname);
     //~ echo '</pre>'.PHP_EOL;
     if (isset($this->element['source_parameter']) && isset($this->element['target_parameter']) && $flag) {
         //$this_field_name = $this->name;
         $this_field_name = (string) $this->element['name'];
         $this_field_name = $this->origname;
         //~ echo '<pre> $this_field_name ='.PHP_EOL;
         //~ print_r($this_field_name);
         //~ echo '</pre>'.PHP_EOL;
         if ($debug) {
             dumpMessage($this_field_name);
         }
         if ($debug) {
             dumpTrace();
         }
         if (empty($from_params)) {
             $key_in_params = (string) $GLOBALS['variablefield']['fields'][0]->element['name'];
             $from_params = $GLOBALS['variablefield']['fields'][0]->form->getData()->toObject()->params->{$key_in_params};
             //~ echo '<pre>'.PHP_EOL;
             //~ print_r($from_params);
             //~ echo '</pre>'.PHP_EOL;
             if ($debug) {
                 dump($from_params, '$from_params');
             }
         }
         //~ echo '<pre style="background:red"> defaults = '.PHP_EOL;
         //~ print_r($defaults);
         //~ echo '</pre>'.PHP_EOL;
         if ($debug) {
             dump($this, '$this');
         }
         if ($debug) {
             dumpMessage($this_field_name);
         }
         if (!isset($count[$this_field_name])) {
             $count[$this_field_name] = 0;
         } else {
             $count[$this_field_name]++;
             $count[$this_field_name]++;
         }
         $index = $count[$this_field_name];
         $source_parameters = explode(',', (string) $this->element['source_parameter']);
         $target_parameters = explode(',', (string) $this->element['target_parameter']);
         //if($debug) dump ($this_field_name,'$this_field_name');
         if ($debug) {
             dump((string) $this->element['target_parameter'], (string) $this->element['source_parameter']);
         }
         $get_joomla_content_type_by_id = (string) $this->element['get_joomla_content_type_by_id'];
         //if($debug) dump ($get_joomla_content_type_by_id,'$get_joomla_content_type_by_id');
         foreach ($source_parameters as $k => $source_parameter) {
             $values = array();
             //~ if($debug) dump ($source_parameter,'$source_parameter');
             //~ if($debug) dump ($count[$this_field_name],'$count[$this_field_name]');
             if ($debug) {
                 dump($index, '$index');
             }
             if (!isset($from_params[$source_parameter])) {
                 for ($i = 0; $i < $index + 1; $i++) {
                     if ($i == $index) {
                         $values[] = $defaults[$source_parameter];
                     } else {
                         $values[] = null;
                     }
                 }
                 if ($debug) {
                     dump($values, '$values 1');
                 }
             } else {
                 $values = $from_params[$source_parameter];
                 if ($debug) {
                     dump($values, '$values 2');
                 }
             }
             if (is_array($values[$index])) {
                 $this->element[$target_parameters[$k]] = implode(',', $values[$index]);
             } else {
                 if ($debug) {
                     dumpMessage(' Setting <b>' . $target_parameters[$k] . '</b> to  <b>' . $values[$index] . '</b>');
                 }
                 $this->element[$target_parameters[$k]] = $values[$index];
             }
         }
     }
     $basetype = isset($this->element['basetype']) ? $this->element['basetype'] : 'text';
     $basetype = (string) $basetype;
     if ($basetype == 'group' || !empty($GLOBALS['variablefield']['current_group'])) {
         //If start or end of group
         return null;
     } else {
         //Let show the script, that the group has ended
         $formfield = JFormHelper::loadFieldType($basetype);
         $formfield->setup($this->element, '');
         return $formfield->getLabel();
     }
     return null;
 }
Beispiel #4
0
        }
    }
} else {
    $user = User::getKV('nickname', $nickname);
    $users = array($user->id);
}
$output = array();
foreach ($users as $id) {
    $user = User::getKV('id', $id);
    if (!$user) {
        throw new Exception("No user for id {$id}");
    }
    $auth = twitterAuthForUser($user);
    $flink = Foreign_link::getByUserID($user->id, TWITTER_SERVICE);
    $friends->friends = $auth->friendsIds();
    dumpMessage($flink, $friends);
    $timeline = $auth->statusesHomeTimeline();
    foreach ($timeline as $status) {
        $output[] = prepMessage($flink, $status);
    }
}
usort($output, function ($a, $b) {
    if ($a->message->id < $b->message->id) {
        return -1;
    } else {
        if ($a->message->id == $b->message->id) {
            return 0;
        } else {
            return 1;
        }
    }
 /**
  * Chama o Gateway conforme a forma que se chamou a função.
  * Se chamou com o prefixo getGW já retorna o Gateway instânciado. como
  * exemplo getGWNomegateway() retorna o gateway "Nomegateway"
  *
  * Se chamou no formato nomegateway_nomeFuncao() chama a função
  * nomeFuncao() do gateway chamado Nomegateway.
  *
  * @param String $name
  * @param array $args
  */
 public function __call($name, $args)
 {
     //TODO interage sobre a variavel de instancia $gateway para obter o
     // seviço que atende a chamada desta função, servindo
     if (JDEBUG) {
         dump($name, "Nome da função chamada");
         dump($args, "Argumentos passados");
         dump(stripos($name, "getGW"), "Posição da String getGW");
         dump(stripos($name, '_'), "Posição do separador nome gateway nome função");
     }
     if (stripos($name, "getGW") === 0) {
         $gwName = ucfirst(str_replace('getGW', '', $name));
         if (array_key_exists($gwName, $this->gateways)) {
             $gw = $this->gateways[$gwName];
             if (JDEBUG) {
                 dump($gw, "Gateway já existe");
             }
         } else {
             if (JDEBUG) {
                 dumpMessage("Criando Gateway");
             }
             $filename = 'sawee_ws_client_' . strtolower($gwName) . '.php';
             $filepath = $this->basedir . '/gateways/' . $filename;
             if (JDEBUG) {
                 dump($filepath, "Caminho do arquivo do Gateway!");
             }
             if (file_exists($filepath)) {
                 require_once $filepath;
                 $className = 'SAWEE_WS_Client_' . $gwName;
                 $config = $this->getConfig();
                 $gw = new $className($config);
                 $this->gateways[$gwName] = $gw;
             } else {
                 $basedir = trim($this->basedir);
                 if (empty($basedir)) {
                     $basedir = "DIRETORIO NÃO INFORMADO";
                 }
                 throw new SAWEEException("Não foi encontrado o Gateway: {$gwName} o Arquivo: {$filename} não existe no diretório base: {$basedir}");
             }
         }
         if (JDEBUG) {
             dump($gw, "Gateway");
         }
         return $gw;
     } elseif ($pos = stripos($name, '_') > 3) {
         $gwsplit = explode('_', $name, 2);
         $gwName = ucfirst($gwsplit[0]);
         $gwfunc = $gwsplit[1];
         $getgwname = "getGW" . $gwName;
         $gw = $this->{$getgwname}();
         if (JDEBUG) {
             dump($gw, "Gateway");
         }
         if ($gw == null) {
             throw SAWEEException("Não foi possivel encontrar um Gateway de nome: {$gwName}, verifique o nome informado!");
         }
         if (!method_exists($gw, $gwfunc)) {
             throw new SAWEEException("O objeto {$gwName}, não tem o método de nome: {$gwfunc}");
         }
         $result = call_user_func_array(array($gw, $gwfunc), $args);
         if (JDEBUG) {
             dump($result, "Result from Gateway");
         }
         return $result;
     }
     return null;
 }
Beispiel #6
0
require_once $helper;
JoopoaHelper::addCustonACL();
/*
 * Tenha sempre certeza que o usuário tem acesso a este componente
 */
$user =& JFactory::getUser();
if (!$user->authorize('com_joopoa', 'manage')) {
    $mainframe->redirect('index.php', JText::_('ALERTNOTAUTH'));
}
$user_option = JRequest::getCmd('option');
$user_controller = JRequest::getCmd('controller', NULL);
$user_task = JRequest::getCmd('task', 'view');
// controla se o script generico do adminform foi adicionado.
global $scriptAdminForm;
$scriptAdminForm = false;
dumpMessage("Debug: Controler -> " . $user_controller);
if (is_null($user_controller) || empty($user_controller)) {
    $controllerFile = JPATH_COMPONENT . DS . 'controller.php';
} else {
    $controllerFile = strtolower($user_controller);
    $controllerFile = JPATH_COMPONENT . DS . 'controllers' . DS . $controllerFile . '.php';
    if (file_exists($controllerFile)) {
        $controllerClass = ucfirst($user_controller);
    } else {
        $app = JFactory::getApplication();
        $app->enqueueMessage("Controlador Inexistente: " . $user_controller);
        JRequest::setVar('layout', NULL);
        JRequest::setVar('task', NULL);
        $controllerFile = JPATH_COMPONENT . DS . 'controller.php';
    }
}