Exemplo n.º 1
0
 public function AddAttach($result, $destination, $type = REALTION_ATTACH)
 {
     $data = array('attach_filename' => $result['value']['name'], 'attach_size' => $result['value']['size'], 'attach_ext' => $result['value']['ext'], 'attach_location' => $result['value']['path'], 'attach_time' => time(), 'attach_label' => $_POST['label'], 'attach_url' => str_replace('../upload/', UR_UPLOAD, $result['value']['path']));
     $id = $this->Create($data);
     $rel = TRelation::GetInstance();
     return $rel->Add($id, $destination, $type);
 }
Exemplo n.º 2
0
 public function GetAttached($destination, $type = REALTION_ATTACH)
 {
     $rel = TRelation::GetInstance();
     $result = $rel->GetByDestination($destination, $type);
     if (count($result) > 0) {
         $sql = "SELECT attach_label,attach_id FROM %table% WHERE attach_id IN(" . implode(',', $result) . ') ;';
         $result = $this->db->select($sql, array('attach'));
     }
     return $result;
 }
Exemplo n.º 3
0
 /**
  * Get categories of a destination
  * @param int $destination destination id
  * @param int $type
  */
 public function GetCategories($destination, $type = RELATION_CATEGORY)
 {
     // Pre hook
     _hk('P' . ':' . __CLASS__ . ':' . __FUNCTION__, $this, $destination, $type);
     $rel = TRelation::GetInstance();
     $sources = $rel->GetByDestination($destination, $type);
     $result = $this->GetCheckedCategories($sources);
     // result hook
     _hk('R' . ':' . __CLASS__ . ':' . __FUNCTION__, $this, $result);
     return $result;
 }
Exemplo n.º 4
0
<?php

$topix = GetTopicByLiker($url[1], 10);
$smarty->assign('topix', $topix);
$r = TRelation::GetInstance();
$member['likes'] = $r->GetSourceCount($url[1], REALTION_LIKE);
$member['frinds'] = $r->GetSourceCount($url[1], REALTION_FRIEND);
$member['comz'] = GetCount('comment', ' comment_member_id = ' . (int) $_COOKIE['mid']);
$smarty->assign('member', $member);
$smarty->assign('frindz', GetFrienz($url[1]));
$idd = isset($_COOKIE['mid']) ? $_COOKIE['mid'] : 0;
$smarty->assign('is_f', $r->Has($idd, $url[1], REALTION_FRIEND));
Exemplo n.º 5
0
 public function CatSync($id)
 {
     $rel = TRelation::GetInstance();
     $rel->Sync($_POST['category'], $id, RELATION_CATEGORY);
     unset($_POST['category']);
 }
Exemplo n.º 6
0
function GetAttached($destination, $type = REALTION_ATTACH)
{
    global $database_handle;
    $rel = TRelation::GetInstance();
    $result = $rel->GetByDestination($destination, $type);
    if (count($result) > 0) {
        $sql = "SELECT attach_filename,attach_url FROM %table% WHERE attach_id IN(" . implode(',', $result) . ') ;';
        $result = $database_handle->select($sql, array('attach'));
    }
    return $result;
}
Exemplo n.º 7
0
<?php

$rel_cls = TRelation::GetInstance();
function GetRelDst($typ, $table, $arg = array())
{
    // get global array
    global $ID, $database_handle;
    $fields = isset($arg['fields']) ? $arg['fields'] : '*';
    $prefix = isset($arg['prefix']) ? $arg['prefix'] : $table . '_';
    $order = isset($arg['order']) ? $arg['order'] : $prefix . 'id DESC';
    $filter = isset($arg['rule']) ? ' AND ' . $arg['rule'] : null;
    $rule = isset($arg['rule']) ? ' AND ' . $arg['rule'] : null;
    $sql = "SELECT  o.{$fields} FROM " . DB_PREFIX . "relation AS r " . "JOIN %table% AS o ON  r.src = o.{$prefix}id WHERE " . "r.dst = {$ID} AND r.typ = {$typ} {$rule} {$filter} ORDER BY {$order} ;";
    //    die($sql);
    return $database_handle->Select($sql, array($table));
}
function GetRelSrc($typ, $table, $arg = array())
{
    // get global array
    global $ID, $database_handle;
    $fields = isset($arg['fields']) ? $arg['fields'] : '*';
    $prefix = isset($arg['prefix']) ? $arg['prefix'] : $table . '_';
    $order = isset($arg['order']) ? $arg['order'] : $prefix . 'id DESC';
    $filter = isset($arg['filter']) ? ' AND ' . $arg['filter'] : null;
    $rule = isset($arg['rule']) ? ' AND ' . $arg['rule'] : null;
    $sql = "SELECT  o.{$fields} FROM " . DB_PREFIX . "relation AS r " . "JOIN %table% AS o ON  r.dst = o.{$prefix}id WHERE " . "r.src = {$ID} AND r.typ = {$typ} {$rule} {$filter} ORDER BY {$order} ;";
    //    die($sql);
    return $database_handle->Select($sql, array($table));
}
function GetTag($suffix = null, $arg = array())
{
Exemplo n.º 8
0
 public function RemoveAttach($attach_id, $destination, $type = REALTION_ATTACH)
 {
     $rel = TRelation::GetInstance();
     $rel->Remove($attach_id, $destination, $type);
     GoBack();
 }