function getUserListFromDB()
{
    global $db;
    $q = $db->dq("SELECT * FROM {$db->prefix}users");
    while ($r = $q->fetch_assoc($q)) {
        ?>
		<tr>
			<td valign="left" class="username"><?php 
        echo $r['username'];
        ?>
</td>
			<td valign="left" class="email"><?php 
        echo $r['email'];
        ?>
</td>
			<td valign="left" class="role"><?php 
        echo _e('um_rolename_' . $r['role']);
        ?>
</td>
			<td valign="left" class="notification"><?php 
        echo NotificationListener::hasGlobalNotifications($r['id']) ? _e('um_notification_on') : _e('um_notification_off');
        ?>
</td>
			<td>
				<a href="#" class="edituser" rel="<?php 
        echo $r['id'];
        ?>
"><?php 
        _e('action_edit');
        ?>
</a>
				<?php 
        if ($r['id'] != $_SESSION['userid']) {
            ?>
				&nbsp;|&nbsp;
				<a href="#" class="deleteuser" rel="<?php 
            echo $r['id'];
            ?>
"><?php 
            _e('action_delete');
            ?>
</a>
				<?php 
        }
        ?>
			</td>
		</tr>
		<?php 
    }
}
Exemple #2
0
 protected function notifications()
 {
     $this->myModel = new OrderModel();
     $response = NotificationListener::main();
     // Verifica se a transação foi paga
     if ($response->getStatus()->getValue() == 3) {
         // Atualiza status no documento
         $data = new stdclass();
         $data->id = $response->getReference();
         $data->status = Config::read('order.status')['paid'];
         $this->myModel->update($data);
         if ($this->myModel->inboxModel) {
             $order = $this->myModel->selectForDetail($response->getReference());
             // // Mensagem para o vendedor
             // $data = new stdclass;
             // $data->title     = 'Confirmação de pagamento - Pedido nro. '.$response->getReference();
             // $data->text      = 'O pedido nro. '.$response->getReference().' foi PAGO, envie o produto pelos Correios e insira o código de rastreio em nosso sistema para atualizar o status. O dinheiro será depositado após a confirmação de recebimento pelo comprador.';
             // $data->type      = 'order';
             // $data->reference = $response->getReference();
             // $data->account   = $order->vendor;
             // $this->myModel->inboxModel->insert( $data );
             // // Mensagem para o comprador
             // $data = new stdclass;
             // $data->title     = 'Confirmação de pagamento - Pedido nro. '.$response->getReference();
             // $data->text      = 'O pedido nro. '.$response->getReference().' foi PAGO e o comprador já esta despachando o produto, aguarde a atualização do chamado com o código de rastreio e após recebimento atualize o status do pedido em nosso sistema.';
             // $data->type      = 'order';
             // $data->reference = $response->getReference();
             // $data->account   = $order->buyer;
             // $this->myModel->inboxModel->insert( $data );
         }
     }
 }
Exemple #3
0
function loadTasks($listId, $compl = 0, $tag = '', $s = '', $sort = 0, $setCompl = 0, $setNotification = null)
{
    $db = DBConnection::instance();
    $sqlWhere = $inner = '';
    if ($listId == -1) {
        $userLists = getUserListsSimple();
        $sqlWhere .= " AND {$db->prefix}todolist.list_id IN (" . implode(array_keys($userLists), ',') . ") ";
    } else {
        $sqlWhere .= " AND {$db->prefix}todolist.list_id=" . $listId;
    }
    if ($compl == 0) {
        $sqlWhere .= ' AND compl=0';
    }
    $tag = trim($tag);
    if ($tag != '') {
        $at = explode(',', $tag);
        $tagIds = array();
        $tagExIds = array();
        foreach ($at as $i => $atv) {
            $atv = trim($atv);
            if ($atv == '' || $atv == '^') {
                continue;
            }
            if (substr($atv, 0, 1) == '^') {
                $tagExIds[] = getTagId(substr($atv, 1));
            } else {
                $tagIds[] = getTagId($atv);
            }
        }
        if (sizeof($tagIds) > 1) {
            $inner .= "INNER JOIN (SELECT task_id, COUNT(tag_id) AS c FROM {$db->prefix}tag2task WHERE list_id={$listId} AND tag_id IN (" . implode(',', $tagIds) . ") GROUP BY task_id) AS t2t ON id=t2t.task_id";
            $sqlWhere = " AND c=" . sizeof($tagIds);
            //overwrite sqlWhere!
        } elseif ($tagIds) {
            $inner .= "INNER JOIN {$db->prefix}tag2task ON {$db->prefix}todolist.id={$db->prefix}tag2task.task_id";
            $sqlWhere .= " AND {$db->prefix}tag2task.tag_id = " . $tagIds[0];
        }
        if ($tagExIds) {
            $sqlWhere .= " AND id NOT IN (SELECT DISTINCT task_id FROM {$db->prefix}tag2task WHERE list_id={$listId} AND tag_id IN (" . implode(',', $tagExIds) . "))";
            //DISTINCT ?
        }
    }
    $s = trim($s);
    if ($s != '') {
        $sqlWhere .= " AND (title LIKE " . $db->quoteForLike("%%%s%%", $s) . " OR note LIKE " . $db->quoteForLike("%%%s%%", $s) . ")";
    }
    $sort = $sort;
    $sqlSort = "ORDER BY compl ASC, ";
    if ($sort == 1) {
        $sqlSort .= "prio DESC, ddn ASC, duedate ASC, ow ASC";
    } elseif ($sort == 101) {
        $sqlSort .= "prio ASC, ddn DESC, duedate DESC, ow DESC";
    } elseif ($sort == 2) {
        $sqlSort .= "ddn ASC, duedate ASC, prio DESC, ow ASC";
    } elseif ($sort == 102) {
        $sqlSort .= "ddn DESC, duedate DESC, prio ASC, ow DESC";
    } elseif ($sort == 3) {
        $sqlSort .= "d_created ASC, prio DESC, ow ASC";
    } elseif ($sort == 103) {
        $sqlSort .= "d_created DESC, prio ASC, ow DESC";
    } elseif ($sort == 4) {
        $sqlSort .= "d_edited ASC, prio DESC, ow ASC";
    } elseif ($sort == 104) {
        $sqlSort .= "d_edited DESC, prio ASC, ow DESC";
    } else {
        $sqlSort .= "ow ASC";
    }
    $t = array();
    $t['total'] = 0;
    $t['list'] = array();
    $q = $db->dq("SELECT *, duedate IS NULL AS ddn FROM {$db->prefix}todolist {$inner} WHERE 1=1 {$sqlWhere} {$sqlSort}");
    while ($r = $q->fetch_assoc($q)) {
        $t['total']++;
        $t['list'][] = prepareTaskRow($r);
    }
    if ($setCompl && have_write_access($listId)) {
        $bitwise = $compl == 0 ? 'taskview & ~1' : 'taskview | 1';
        $db->dq("UPDATE {$db->prefix}lists SET taskview={$bitwise} WHERE id={$listId}");
    }
    if (($setNotification === '0' || $setNotification === '1') && have_write_access($listId)) {
        if ($setNotification == 1) {
            NotificationListener::enableNotification(NotificationListener::LISTENER_TYPE_LIST, $listId);
        } else {
            NotificationListener::disableNotification(NotificationListener::LISTENER_TYPE_LIST, $listId);
        }
    }
    return $t;
}
Exemple #4
0
    }
    /**
     * verifyData - Corrige os dados enviados via post
     * @data string Dados enviados via post
     */
    private static function verifyData($data)
    {
        return isset($data) && trim($data) !== "" ? trim($data) : null;
    }
    /**
     * getConfig - Retorna as configurações definidas para as credenciais
     * @return array Array contendo as credenciais do usuário
     */
    private static function getConfig()
    {
        global $db;
        $config = array();
        // Settings
        $query = $db->query("SELECT value FROM " . DB_PREFIX . "setting s where s.key='pagseguro_mail'");
        $config['email'] = $query->row['value'];
        $query = $db->query("SELECT value FROM " . DB_PREFIX . "setting s where s.key='pagseguro_token'");
        $config['token'] = $query->row['value'];
        return $config;
    }
    private static function saveLog($strType = null)
    {
        #LogPagSeguro::getHtml();
    }
}
NotificationListener::main();
 /**
  * @static
  * @param $type
  * @param array $value
  * @return array
  * @throws Exception
  */
 public static function findByListenerTypeAndValue($type, $value = null)
 {
     if ($type !== NotificationListener::LISTENER_TYPE_GLOBAL && empty($value)) {
         throw new Exception('Can not find non-global listener (' . $type . ') without a list or task id (' . $value . ')');
     }
     $return = array();
     $db = DBConnection::instance();
     if ($type === NotificationListener::LISTENER_TYPE_GLOBAL) {
         $result = $db->dq("SELECT * FROM {$db->prefix}notification_listeners WHERE type = 'global'");
     } else {
         $result = $db->dq("SELECT * FROM {$db->prefix}notification_listeners WHERE type = ? AND value = ?", array($type, $value));
     }
     while ($row = $result->fetch_assoc()) {
         $item = new NotificationListener();
         $item->setType($row['type']);
         $item->setUserid($row['user_id']);
         if ($type !== NotificationListener::LISTENER_TYPE_GLOBAL) {
             $item->setValue($row['value']);
         }
         $return[] = $item;
     }
     return $return;
 }
Exemple #6
0
echo $multiUser ? "true" : "false";
?>
,
			admin: <?php 
echo is_admin() ? "true" : "false";
?>
,
			readOnly: <?php 
echo is_readonly() ? "true" : "false";
?>
,
			<?php 
if (isset($_SESSION['userid'])) {
    ?>
			globalNotifications: <?php 
    echo NotificationListener::hasGlobalNotifications($_SESSION['userid']) ? "true" : "false";
    ?>
,
			userId: <?php 
    echo !empty($_SESSION['userid']) ? $_SESSION['userid'] : 'null';
    ?>
,
			userRole: <?php 
    echo !empty($_SESSION['role']) ? $_SESSION['role'] : 'null';
    ?>
,
			<?php 
}
?>
			isLogged: <?php 
echo $needAuth && is_logged() ? "true" : "false";