The best recommendations is to put these in a separate library. It’s not related to the model (database/fields), the operator logic of the controller (coordinates and takes user input), or the views (display). You can either put your generic functions for your project in /protected/components , or create an extension.
MVC should be renamed to MVCL, that is Model-View-Controller-Library. These kind of functions should go into a separate system of libraries.
If you are using a 3rd-party library (an encryption class for example), then you could include the class in your components folder where your application should be automatically loading it. Then, instantiate the class and use as necessary.
Posted in: Yii