Exemplo n.º 1
0
 /**
  * Массовое обновление статуса на все продукты,
  * в соответствии с их активными товарными предложениями и активными торговыми акциями
  */
 public static function massUpdateProductsStatuses()
 {
     $sql = "update " . Product::TABLE_NAME . " set status = 0";
     \DB::update($sql);
     $sql = "update " . Product::TABLE_NAME . " p\n                  join products_offers po on p.id = po.product_id\n                  join catalogs ct on ct.id = po.catalog_id\n                set p.status = 1\n                where ct.status = 1 and po.status = 1";
     \DB::update($sql);
 }
Exemplo n.º 2
0
 public function upload()
 {
     $ds = DIRECTORY_SEPARATOR;
     //1
     $storeFolder = PATH_UPLOAD . 'profile/';
     //2
     extract($_POST);
     if (!empty($_FILES)) {
         $filename = Str::sanitize($_FILES['file']['name']);
         if (copy($_FILES['file']['tmp_name'], $storeFolder . $filename)) {
             $id = DB::update('users', $_SESSION['user_id'], $section, array($section => $filename));
             Image::resize_group($storeFolder, $filename);
             return array('success' => true, 'id' => $id);
         }
         return array("error" => "Could not write to fs");
     }
 }
Exemplo n.º 3
0
    public function add()
    {
        extract($_REQUEST);
        $now = time();
        $lastid = DB::update('feed', $id, '*');
        /*
        		preg_match_all('/(#\w+)/', $status, $matches);
        		foreach ($matches[0] as $hashtag)
           echo $hashtag . ' ';
        */
        preg_match_all("/(@\\w+)/", $status, $matches);
        foreach ($matches[0] as $mentiontag) {
            $user_id = DB::query('select id from users where username = \'' . str_replace('@', '', $mentiontag) . '\'', '2', 'id');
            if ($user_id) {
                DB::write('insert into mentions set 
					user_id = ' . $_SESSION['user_id'] . ', 
					user2_id = ' . $user_id . ', 
					feed_id = ' . $lastid . ', 
					created_ts = ' . $now);
            }
        }
        $entry = feedController::status($lastid);
        return array('entry' => $entry);
    }
Exemplo n.º 4
0
 public function update()
 {
     $_POST['user_id'] = $_SESSION['user_id'];
     return DB::update('webcams', $_POST['id'], '*', $_POST);
 }