当前位置: 首页>>代码示例>>PHP>>正文


PHP Module::dependencies方法代码示例

本文整理汇总了PHP中Module::dependencies方法的典型用法代码示例。如果您正苦于以下问题:PHP Module::dependencies方法的具体用法?PHP Module::dependencies怎么用?PHP Module::dependencies使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Module的用法示例。


在下文中一共展示了Module::dependencies方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: text

 public static function text($database, $type, $function, $line, $text = '')
 {
     # Check dependencies
     Module::dependencies(isset($database, $type, $function, $line, $text));
     # Get time
     $sysstamp = time();
     # Save in database
     $query = Database::prepare($database, "INSERT INTO ? (time, type, function, line, text) VALUES ('?', '?', '?', '?', '?')", array(LYCHEE_TABLE_LOG, $sysstamp, $type, $function, $line, $text));
     $result = $database->query($query);
     if (!$result) {
         return false;
     }
     return true;
 }
开发者ID:neynah,项目名称:Lychee,代码行数:14,代码来源:Log.php

示例2: text

 public static function text($database, $type, $function, $line, $text = '')
 {
     # Check dependencies
     Module::dependencies(isset($database, $type, $function, $line, $text));
     # Get time
     $sysstamp = time();
     # Save in database
     $stmt = $database->prepare("INSERT INTO " . LYCHEE_TABLE_LOG . " (time, type, function, line, text) VALUES (?, ?, ?, ?, ?)");
     $result = $stmt->execute(array($sysstamp, $type, $function, $line, $text));
     if (!$result) {
         return false;
     }
     return true;
 }
开发者ID:rssc,项目名称:Lychee,代码行数:14,代码来源:Log.php

示例3: getPhotoArchive

 private function getPhotoArchive()
 {
     Module::dependencies(isset($_GET['photoID']));
     $photo = new Photo($this->database, $this->plugins, null, $_GET['photoID']);
     $photo->getArchive();
 }
开发者ID:fredrikcarno,项目名称:Lychee,代码行数:6,代码来源:Admin.php

示例4: prepare

 static function prepare($database, $query, $data)
 {
     # Check dependencies
     Module::dependencies(isset($database, $query, $data));
     # Count the number of placeholders and compare it with the number of arguments
     # If it doesn't match, calculate the difference and skip this number of placeholders before starting the replacement
     # This avoids problems with placeholders in user-input
     # $skip = Number of placeholders which need to be skipped
     $skip = 0;
     $num = array('placeholder' => substr_count($query, '?'), 'data' => count($data));
     if ($num['data'] - $num['placeholder'] < 0) {
         Log::notice($database, __METHOD__, __LINE__, 'Could not completely prepare query. Query has more placeholders than values.');
     }
     foreach ($data as $value) {
         # Escape
         $value = mysqli_real_escape_string($database, $value);
         # Recalculate number of placeholders
         $num['placeholder'] = substr_count($query, '?');
         # Calculate number of skips
         if ($num['placeholder'] > $num['data']) {
             $skip = $num['placeholder'] - $num['data'];
         }
         if ($skip > 0) {
             # Need to skip $skip placeholders, because the user input contained placeholders
             # Calculate a substring which does not contain the user placeholders
             # 1 or -1 is the length of the placeholder (placeholder = ?)
             $pos = -1;
             for ($i = $skip; $i > 0; $i--) {
                 $pos = strpos($query, '?', $pos + 1);
             }
             $pos++;
             $temp = substr($query, 0, $pos);
             # First part of $query
             $query = substr($query, $pos);
             # Last part of $query
         }
         # Replace
         $query = preg_replace('/\\?/', $value, $query, 1);
         if ($skip > 0) {
             # Reassemble the parts of $query
             $query = $temp . $query;
         }
         # Reset skip
         $skip = 0;
         # Decrease number of data elements
         $num['data']--;
     }
     return $query;
 }
开发者ID:TheMadav,项目名称:Lychee,代码行数:49,代码来源:Database.php

示例5: getPhotoArchive

 private function getPhotoArchive()
 {
     Module::dependencies(isset($_GET['photoID'], $_GET['password']));
     $photo = new Photo($this->database, $this->plugins, null, $_GET['photoID']);
     $pgP = $photo->getPublic($_GET['password']);
     # Photo Download
     if ($pgP === 2) {
         # Photo Public
         $photo->getArchive();
     } else {
         # Photo Private
         exit('Warning: Photo private or password incorrect!');
     }
 }
开发者ID:thejandroman,项目名称:Lychee,代码行数:14,代码来源:Guest.php

示例6: dbCreateConfig

 private function dbCreateConfig()
 {
     Module::dependencies(isset($_POST['dbHost'], $_POST['dbUser'], $_POST['dbPassword'], $_POST['dbName'], $_POST['dbTablePrefix']));
     echo Database::createConfig($_POST['dbHost'], $_POST['dbUser'], $_POST['dbPassword'], $_POST['dbName'], $_POST['dbTablePrefix']);
 }
开发者ID:fredrikcarno,项目名称:Lychee,代码行数:5,代码来源:Installation.php

示例7: createTables

 static function createTables($database, $type = 'mysql')
 {
     # Check dependencies
     Module::dependencies(isset($database));
     # Create log
     $result = $database->query('SELECT * FROM ' . LYCHEE_TABLE_LOG . ' LIMIT 0');
     if ($result === FALSE) {
         # Read file
         $file = __DIR__ . '/../database/log_table_' . $type . '.sql';
         $query = @file_get_contents($file);
         if (!isset($query) || $query === false) {
             return false;
         }
         # Create table
         # Replace table prefix in query loaded from file (native parametrization of identifiers not supported in PDO)
         $query = str_replace("_PREFIX_", LYCHEE_TABLE_PREFIX, $query);
         $result = $database->exec($query);
         if ($result === FALSE) {
             error_log(print_r($database->errorInfo(), TRUE));
             return false;
         }
     }
     # Create settings
     $result = $database->query('SELECT * FROM ' . LYCHEE_TABLE_SETTINGS . ' LIMIT 0');
     if ($result === FALSE) {
         # Read file
         $file = __DIR__ . '/../database/settings_table_' . $type . '.sql';
         $query = @file_get_contents($file);
         if (!isset($query) || $query === false) {
             Log::error($database, __METHOD__, __LINE__, 'Could not load query for lychee_settings');
             return false;
         }
         # Create table
         # Replace table prefix in query loaded from file (native parametrization of identifiers not supported in PDO)
         $query = str_replace("_PREFIX_", LYCHEE_TABLE_PREFIX, $query);
         $result = $database->exec($query);
         if ($result === FALSE) {
             Log::error($database, __METHOD__, __LINE__, print_r($database->errorInfo(), TRUE));
             return false;
         }
         Log::notice($database, __METHOD__, __LINE__, "Created settings table.");
         # Read file
         $file = __DIR__ . '/../database/settings_content_' . $type . '.sql';
         $query = @file_get_contents($file);
         if (!isset($query) || $query === false) {
             Log::error($database, __METHOD__, __LINE__, 'Could not load content-query for lychee_settings');
             return false;
         }
         # Add content
         $query = str_replace("_PREFIX_", LYCHEE_TABLE_PREFIX, $query);
         $result = $database->exec($query);
         if ($result === FALSE) {
             Log::error($database, __METHOD__, __LINE__, "Could not create settings table: " . print_r($database->errorInfo(), TRUE));
             return false;
         }
         Log::notice($database, __METHOD__, __LINE__, "Added content to settings table.");
         # Generate identifier
         $identifier = md5(microtime(true));
         $stmt = $database->prepare("UPDATE " . LYCHEE_TABLE_SETTINGS . " SET value = ? WHERE key = 'identifier'");
         if (!$stmt) {
             Log::error($database, __METHOD__, __LINE__, "Could not prepare statement: " . print_r($database->errorInfo(), TRUE));
             return false;
         }
         $result = $stmt->execute(array($identifier));
         if ($result === FALSE) {
             Log::error($database, __METHOD__, __LINE__, print_r($stmt->errorInfo(), TRUE));
             return false;
         }
     }
     # Create albums
     $result = $database->query('SELECT * FROM ' . LYCHEE_TABLE_ALBUMS . ' LIMIT 0');
     if ($result === FALSE) {
         # Read file
         $file = __DIR__ . '/../database/albums_table_' . $type . '.sql';
         $query = @file_get_contents($file);
         if (!isset($query) || $query === false) {
             Log::error($database, __METHOD__, __LINE__, 'Could not load query for lychee_albums');
             return false;
         }
         # Create table
         # Replace table prefix in query loaded from file (native parametrization of identifiers not supported in PDO)
         $query = str_replace("_PREFIX_", LYCHEE_TABLE_PREFIX, $query);
         $result = $database->exec($query);
         if ($result === FALSE) {
             Log::error($database, __METHOD__, __LINE__, print_r($database->errorInfo(), TRUE));
             return false;
         }
     }
     # Create photos
     $result = $database->query('SELECT * FROM ' . LYCHEE_TABLE_PHOTOS . ' LIMIT 0');
     if ($result === FALSE) {
         # Read file
         $file = __DIR__ . '/../database/photos_table_' . $type . '.sql';
         $query = @file_get_contents($file);
         if (!isset($query) || $query === false) {
             Log::error($database, __METHOD__, __LINE__, 'Could not load query for lychee_photos');
             return false;
         }
         # Create table
         # Replace table prefix in query loaded from file (native parametrization of identifiers not supported in PDO)
//.........这里部分代码省略.........
开发者ID:rssc,项目名称:Lychee,代码行数:101,代码来源:Database.php

示例8: getPhotoArchive

 private function getPhotoArchive()
 {
     Module::dependencies(isset($_GET['photoID']));
     $photo = new Photo(null, $_GET['photoID']);
     $photo->getArchive();
 }
开发者ID:waitman,项目名称:Lychee,代码行数:6,代码来源:Admin.php


注:本文中的Module::dependencies方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。