Ejemplo n.º 1
0
 public static function Logging(User $user, Package $pkg, mfwUserAgent $ua, $con = null)
 {
     $now = date('Y-m-d H:i:s');
     $sql = 'INSERT INTO install_log' . ' (app_id,package_id,mail,user_agent,installed)' . ' VALUES (:app_id,:package_id,:mail,:user_agent,:installed)';
     $bind = array(':app_id' => $pkg->getAppId(), ':package_id' => $pkg->getId(), ':mail' => $user->getMail(), ':user_agent' => $ua->getString(), ':installed' => $now);
     mfwDBIBase::query($sql, $bind, $con);
     $sql = 'INSERT INTO app_install_user (app_id,mail,last_installed) VALUES (:app_id,:mail,:last_installed) ON DUPLICATE KEY UPDATE last_installed=:last_installed';
     $bind = array(':app_id' => $pkg->getAppId(), ':mail' => $user->getMail(), ':last_installed' => $now);
     mfwDBIBase::query($sql, $bind, $con);
 }
Ejemplo n.º 2
0
 protected function makePackageArray(Package $pkg)
 {
     $tags = array();
     foreach ($pkg->getTags() as $t) {
         $tags[] = $t->getName();
     }
     return array('package_url' => mfwRequest::makeUrl("/package?id={$pkg->getId()}"), 'application_url' => mfwRequest::makeUrl("/app?id={$pkg->getAppId()}"), 'id' => $pkg->getId(), 'platform' => $pkg->getPlatform(), 'title' => $pkg->getTitle(), 'description' => $pkg->getDescription(), 'ios_identifier' => $pkg->getIOSIdentifier(), 'original_file_name' => $pkg->getOriginalFileName(), 'file_size' => $pkg->getFileSize(), 'created' => $pkg->getCreated(), 'tags' => $tags, 'install_count' => $pkg->getInstallCount());
 }
Ejemplo n.º 3
0
 public function getPackageInstalledDate(Package $pkg, $format = null)
 {
     $appid = $pkg->getAppId();
     if (!isset($this->pkg_install_dates[$appid])) {
         $this->pkg_install_dates[$appid] = InstallLog::packageInstalledDates($this, $appid);
     }
     if (!isset($this->pkg_install_dates[$appid][$pkg->getId()])) {
         return null;
     }
     $date = $this->pkg_install_dates[$appid][$pkg->getId()];
     if ($format) {
         $date = date($format, strtotime($date));
     }
     return $date;
 }