List sieve scripts

@return array Scripts list
166325
public function list_scripts()
    {
        if ($this->list !== null) {
            return $this->list;
        }

        $this->list = $this->sieve->get_scripts();

        // Handle active script(s) and list of scripts according to Kolab's KEP:14
        if ($this->rc->config->get('managesieve_kolab_master')) {
            // Skip protected names
            foreach ((array)$this->list as $idx => $name) {
                $_name = strtoupper($name);
                if ($_name == 'MASTER')
                    $master_script = $name;
                else if ($_name == 'MANAGEMENT')
                    $management_script = $name;
                else if($_name == 'USER')
                    $user_script = $name;
                else
                    continue;

                unset($this->list[$idx]);
            }

            // get active script(s), read USER script
            if ($user_script) {
                $extension = $this->rc->config->get('managesieve_filename_extension', '.sieve');
                $filename_regex = '/'.preg_quote($extension, '/').'$/';
                $_SESSION['managesieve_user_script'] = $user_script;

                $this->sieve->load($user_script);

                foreach ($this->sieve->script->as_array() as $rules) {
                    foreach ($rules['actions'] as $action) {
                        if ($action['type'] == 'include' && empty($action['global'])) {
                            $name = preg_replace($filename_regex, '', $action['target']);
                            // make sure the script exist
                            if (in_array($name, $this->list)) {
                                $this->active[] = $name;
                            }
                        }
                    }
                }
            }
            // create USER script if it doesn't exist
            else {
                $content = "# USER Management Script\n"
                    ."#\n"
                    ."# This script includes the various active sieve scripts\n"
                    ."# it is AUTOMATICALLY GENERATED. DO NOT EDIT MANUALLY!\n"
                    ."#\n"
                    ."# For more information, see http://wiki.kolab.org/KEP:14#USER\n"
                    ."#\n";
                if ($this->sieve->save_script('USER', $content)) {
                    $_SESSION['managesieve_user_script'] = 'USER';
                    if (empty($this->master_file))
                        $this->sieve->activate('USER');
                }
            }
        }
        else if (!empty($this->list)) {
            // Get active script name
            if ($active = $this->sieve->get_active()) {
                $this->active = array($active);
            }

            // Hide scripts from config
            $exceptions = $this->rc->config->get('managesieve_filename_exceptions');
            if (!empty($exceptions)) {
                $this->list = array_diff($this->list, (array)$exceptions);
            }
        }

        // reindex
        if (!empty($this->list)) {
            $this->list = array_values($this->list);
        }

        return $this->list;
    }
177764
public function getSqlFiles()
    {
        $sqlFinder = $this->getFinder();

        $files = $sqlFinder->files()
            ->in($this->sqlFilesDir)
            ->name(self::PATTERN)
            ->sort($this->sort())
        ;

        return $files;
    }
984517
public function listTables()
    {
        $tables = $this->keyspace->tables();
        $out = [];
        foreach ($tables as $table) {
            $out[] = ['table_name' => $table->name()];
        }

        return $out;
    }
1169141
public function indexAction(Request $request)
    {
        $viewIndex = $this->get('phlexible_gui.view.index');

        return [
            'scripts' => $viewIndex->get($request),
            'noScript' => $viewIndex->getNoScript(),
        ];
    }
828165
public static function listAll()
    {
        $structure = General::listStructure(TOOLKIT . '/fields', '/field.[a-z0-9_-]+.php/i', false, 'asc', TOOLKIT . '/fields');
        $extensions = Symphony::ExtensionManager()->listInstalledHandles();
        $types = array();

        if (is_array($extensions) && !empty($extensions)) {
            foreach ($extensions as $handle) {
                $path = EXTENSIONS . '/' . $handle . '/fields';
                if (is_dir($path)) {
                    $tmp = General::listStructure($path, '/field.[a-z0-9_-]+.php/i', false, 'asc', $path);

                    if (is_array($tmp['filelist']) && !empty($tmp['filelist'])) {
                        $structure['filelist'] = array_merge($structure['filelist'], $tmp['filelist']);
                    }
                }
            }

            $structure['filelist'] = General::array_remove_duplicates($structure['filelist']);
        }

        foreach ($structure['filelist'] as $filename) {
            $types[] = self::__getHandleFromFilename($filename);
        }

        return $types;
    }
856244
public Script[] getScripts(Integer type) {
        ArrayList<Script> returnData = new ArrayList<>();
        PreparedStatement statement = null;
        ResultSet results = null;

        try (Connection sqlConnection = SQLService.getInstance().getConnection()) {

            statement = sqlConnection.prepareStatement("SELECT * FROM " + Constants.DB_TABLE_SCRIPT +
                                                           " ORDER BY " + Constants.GENERIC_ID);
            if (type != null) {
                statement = sqlConnection.prepareStatement("SELECT * FROM " + Constants.DB_TABLE_SCRIPT +
                                                               " WHERE " + Constants.SCRIPT_TYPE + "= ?" +
                                                               " ORDER BY " + Constants.GENERIC_ID);
                statement.setInt(1, type);
            }

            logger.info("Query: {}", statement);

            results = statement.executeQuery();
            while (results.next()) {
                returnData.add(scriptFromSQLResult(results));
            }
        } catch (Exception e) {

        } finally {
            try {
                if (results != null) {
                    results.close();
                }
            } catch (Exception e) {
            }
            try {
                if (statement != null) {
                    statement.close();
                }
            } catch (Exception e) {
            }
        }

        return returnData.toArray(new Script[0]);
    }
384954
public static function getHandleList()
    {
        $db = Database::connection();
        $r = $db->executeQuery('select distinct arHandle from Areas where arParentID = 0 and arIsGlobal = 0 order by arHandle asc');
        $handles = array();
        while ($row = $r->FetchRow()) {
            $handles[] = $row['arHandle'];
        }
        $r->Free();
        unset($r);
        unset($db);

        return $handles;
    }
1143748
public static function available_numofreviews_list() {
        $options = array();
        $options[30] = 30;
        $options[20] = 20;
        $options[15] = 15;
        for ($i = 10; $i >= 0; $i--) {
            $options[$i] = $i;
        }
        return $options;
    }
878130
public static function listAll()
    {
        $result = array();
        $structure = General::listStructure(EMAILGATEWAYS, '/email.[\\w-]+.php/', false, 'ASC', EMAILGATEWAYS);

        if (is_array($structure['filelist']) && !empty($structure['filelist'])) {
            foreach ($structure['filelist'] as $f) {
                $f = str_replace(array('email.', '.php'), '', $f);
                $result[$f] = self::about($f);
            }
        }

        $extensions = Symphony::ExtensionManager()->listInstalledHandles();

        if (is_array($extensions) && !empty($extensions)) {
            foreach ($extensions as $e) {
                if (!is_dir(EXTENSIONS . "/$e/email-gateways")) {
                    continue;
                }

                $tmp = General::listStructure(EXTENSIONS . "/$e/email-gateways", '/email.[\\w-]+.php/', false, 'ASC', EXTENSIONS . "/$e/email-gateways");

                if (is_array($tmp['filelist']) && !empty($tmp['filelist'])) {
                    foreach ($tmp['filelist'] as $f) {
                        $f = preg_replace(array('/^email./i', '/.php$/i'), '', $f);
                        $result[$f] = self::about($f);
                    }
                }
            }
        }

        ksort($result);
        return $result;
    }
912998
public function listFunctions() {
		// Return value
		$returnValue = array();
		// Loop functions
		foreach(self::$_PHPExcelFunctions as $functionName => $function) {
			if ($function['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY') {
				$returnValue[$functionName] = new PHPExcel_Calculation_Function($function['category'],
																				$functionName,
																				$function['functionCall']
																			   );
			}
		}

		// Return
		return $returnValue;
	}
628218
public function getScriptFiles()
	{
		$return = array();
		//$return = $this->coreScripts;
		//print_r($this->coreScripts);
		if(!empty($this->coreScripts)) {
			foreach($this->coreScripts as $key=>$val) {
				if((is_string($key) && $key != 'jquery') && is_array($val)) {
				//if((is_string($key)) && is_array($val))
					if($val['baseUrl'] != null)
						$return[] = /*$this->getProtocol()."://".Yii::app()->request->serverName.*/$val['baseUrl'].'/'.$val['js'][0];
					else 
						$return[] = /*$this->getProtocol()."://".Yii::app()->request->serverName.*/$this->getCoreScriptUrl().'/'.$val['js'][0];
				}
			}
		}
		//echo '===========================================';
		
		//$return = $this->scriptFiles;
		//print_r($this->scriptFiles);
		if(!empty($this->scriptFiles)) {
			foreach($this->scriptFiles as $key=>$val) {
				if((is_string($key)) || is_array($val)) {
					if(!empty($val)) {
						foreach($val as $key=>$row)
							if($key == $row || $row==null)
								$return[] = /*$this->getProtocol()."://".Yii::app()->request->serverName.*/$key;
					}
				}
			}
		}
		return $return;
	}
783655
public function getScripts()
    {
        $retVal = '';
        while ( $this->scripts->valid() ) {
            $retVal .= "<script type='text/javascript'>\n{$this->scripts->get()}\n</script>\n";
            $this->scripts->next();
        }
        
        return $retVal;
    }
142072
public function getCasts()
    {
        if ($this->getIncrementing()) {
            return array_merge([
                $this->getKeyName() => $this->getKeyType(),
            ], $this->casts);
        }

        return $this->casts;
    }
1120268
def scripts
      scripts = []
      Infolist.parse("#{name}_script").each do |script|
        scripts << Script.new(script[:pointer], self)
      end
      scripts
    end
1120501
public function all() {
  $query = new \Peyote\Select($this->db_table());
  $query->columns('name');
  $result = $this->db->fetch($query);
  foreach($result as $r) {
   $list[] = $r['name'];
  }
  return $list;
 }
306485
private function getFileList()
    {

        $count = $this->getFileCount();
        $size = $this->getSize() + 4;

        $this->seek(
            $this->offset
            + 18
            + $this->getAliasSize()
            + 4
            + $this->getMetadataSize()
        );

        return $this->readFileList($count, $size);
    }
582891
public function scripts()
    {
        $scripts = array_map(function ($scriptData) {
            /* @var $scriptData array<string, mixed> */
            return new Script(
                $scriptData['full_path'],
                $this->bytesToMb($scriptData['memory_consumption']),
                $scriptData['hits'],
                new \DateTimeImmutable('@' . $scriptData['last_used_timestamp'])
            );
        }, $this->data['scripts']);
        return new ScriptCollection($scripts, $this->calculateCacheSlots());
    }